G
Guest
Hi,
I want to consume a Web Service that returns a choice, but my C++ client
always receives the same returned type. On the other hand, when I am using a
Java client, it is working fine (of course, the generated proxy is not the
same).
When I am looking at the C++ generated code, it seems fine, but when I am
executing the code, I always get the first choice type.
Do someone already used a returned choice in C++ ?
(I am using Visual Studio 2003).
Here is the execute code:
// -------------------------
// My test code
// -------------------------
Object *queryResult = webService->queryMatchingPersonsByTraits(
fillRequestType(condition), szProductID, Convert::ToString(iMaxReturnRow),
totalNumberOfMatches, timestamp );
Query:ersonQueryResponseTypeMatchingProfiles *profiles =
dynamic_cast<Query:: PersonQueryResponseTypeMatchingProfiles *>(queryResult);
if ( profiles == NULL )
{
Query:ersonQueryResponseTypeError* error =
dynamic_cast<Query:ersonQueryResponseTypeError*> (queryResult);
String *value = error->Value;
}
//I never receive a PersonQueryResponseTypeMatchingProfiles in my C++ code,
but I am receiving some in the Java code.
//---------------------------
// Generated Proxy method declaration
//---------------------------
public:
[System::Web::Services:rotocols::SoapDocumentMethodAttribute(S"http://www.openuri.org/queryMatchingPersonsByTraits",
RequestElementName=S"PersonQueryRequest",
RequestNamespace=S"http://.../personqueryrequest",
ResponseElementName=S"PersonQueryResponse",
ResponseNamespace=S"http://.../personquery",
Use=System::Web::Services:escription::SoapBindingUse::Literal,
ParameterStyle=System::Web::Services:rotocols::SoapParameterStyle::Wrapped)]
[returnvalue: System::Xml::Serialization::XmlElementAttribute(S"Error",
__typeof(Query:ersonQueryResponseTypeError))]
[returnvalue:
System::Xml::Serialization::XmlElementAttribute(S"MatchingProfiles",
__typeof(Query:ersonQueryResponseTypeMatchingProfiles))]
System::Object *
queryMatchingPersonsByTraits(Query:ersonQueryRequestTypeProfileData *
ProfileData, [System::Xml::Serialization::XmlAttributeAttribute]
System::String * SystemID,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * MaxNumMatches,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * & TotalNumberOfMatches,
[System::Xml::Serialization::XmlAttributeAttribute] System:ateTime&
Timestamp);
//---------------------------
// Generated Proxy method definition
//---------------------------
inline System::Object *
Person::queryMatchingPersonsByTraits(Query:ersonQueryRequestTypeProfileData
* ProfileData, [System::Xml::Serialization::XmlAttributeAttribute]
System::String * SystemID,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * MaxNumMatches,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * & TotalNumberOfMatches,
[System::Xml::Serialization::XmlAttributeAttribute] System:ateTime&
Timestamp) {
System::Object* __mcTemp__1[] = new System::Object*[3];
__mcTemp__1[0] = ProfileData;
__mcTemp__1[1] = SystemID;
__mcTemp__1[2] = MaxNumMatches;
System::Object * results[] =
this->Invoke(S"queryMatchingPersonsByTraits", __mcTemp__1);
TotalNumberOfMatches = (__try_cast<System::String * >(results[1]));
Timestamp = (*__try_cast<__box System:ateTime * >(results[2]));
return (__try_cast<System::Object * >(results[0]));
};
// -------------------------------
// XML part
// -------------------------------
…
<xs:element name="QueryResponse" type="pq:QueryResponseType">
</xs:element>
<xs:complexType name="QueryResponseType">
<xs:choice>
<xs:element name="Error">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="pq:ErrorType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Profiles">
<xs:complexType>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:simpleType name="ErrorType">
<xs:restriction base="xs:string">
<xs:enumeration value="client"/>
<xs:enumeration value="server"/>
</xs:restriction>
</xs:simpleType>
…
I want to consume a Web Service that returns a choice, but my C++ client
always receives the same returned type. On the other hand, when I am using a
Java client, it is working fine (of course, the generated proxy is not the
same).
When I am looking at the C++ generated code, it seems fine, but when I am
executing the code, I always get the first choice type.
Do someone already used a returned choice in C++ ?
(I am using Visual Studio 2003).
Here is the execute code:
// -------------------------
// My test code
// -------------------------
Object *queryResult = webService->queryMatchingPersonsByTraits(
fillRequestType(condition), szProductID, Convert::ToString(iMaxReturnRow),
totalNumberOfMatches, timestamp );
Query:ersonQueryResponseTypeMatchingProfiles *profiles =
dynamic_cast<Query:: PersonQueryResponseTypeMatchingProfiles *>(queryResult);
if ( profiles == NULL )
{
Query:ersonQueryResponseTypeError* error =
dynamic_cast<Query:ersonQueryResponseTypeError*> (queryResult);
String *value = error->Value;
}
//I never receive a PersonQueryResponseTypeMatchingProfiles in my C++ code,
but I am receiving some in the Java code.
//---------------------------
// Generated Proxy method declaration
//---------------------------
public:
[System::Web::Services:rotocols::SoapDocumentMethodAttribute(S"http://www.openuri.org/queryMatchingPersonsByTraits",
RequestElementName=S"PersonQueryRequest",
RequestNamespace=S"http://.../personqueryrequest",
ResponseElementName=S"PersonQueryResponse",
ResponseNamespace=S"http://.../personquery",
Use=System::Web::Services:escription::SoapBindingUse::Literal,
ParameterStyle=System::Web::Services:rotocols::SoapParameterStyle::Wrapped)]
[returnvalue: System::Xml::Serialization::XmlElementAttribute(S"Error",
__typeof(Query:ersonQueryResponseTypeError))]
[returnvalue:
System::Xml::Serialization::XmlElementAttribute(S"MatchingProfiles",
__typeof(Query:ersonQueryResponseTypeMatchingProfiles))]
System::Object *
queryMatchingPersonsByTraits(Query:ersonQueryRequestTypeProfileData *
ProfileData, [System::Xml::Serialization::XmlAttributeAttribute]
System::String * SystemID,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * MaxNumMatches,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * & TotalNumberOfMatches,
[System::Xml::Serialization::XmlAttributeAttribute] System:ateTime&
Timestamp);
//---------------------------
// Generated Proxy method definition
//---------------------------
inline System::Object *
Person::queryMatchingPersonsByTraits(Query:ersonQueryRequestTypeProfileData
* ProfileData, [System::Xml::Serialization::XmlAttributeAttribute]
System::String * SystemID,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * MaxNumMatches,
[System::Xml::Serialization::XmlAttributeAttribute(DataType=S"integer")]
System::String * & TotalNumberOfMatches,
[System::Xml::Serialization::XmlAttributeAttribute] System:ateTime&
Timestamp) {
System::Object* __mcTemp__1[] = new System::Object*[3];
__mcTemp__1[0] = ProfileData;
__mcTemp__1[1] = SystemID;
__mcTemp__1[2] = MaxNumMatches;
System::Object * results[] =
this->Invoke(S"queryMatchingPersonsByTraits", __mcTemp__1);
TotalNumberOfMatches = (__try_cast<System::String * >(results[1]));
Timestamp = (*__try_cast<__box System:ateTime * >(results[2]));
return (__try_cast<System::Object * >(results[0]));
};
// -------------------------------
// XML part
// -------------------------------
…
<xs:element name="QueryResponse" type="pq:QueryResponseType">
</xs:element>
<xs:complexType name="QueryResponseType">
<xs:choice>
<xs:element name="Error">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="pq:ErrorType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Profiles">
<xs:complexType>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:simpleType name="ErrorType">
<xs:restriction base="xs:string">
<xs:enumeration value="client"/>
<xs:enumeration value="server"/>
</xs:restriction>
</xs:simpleType>
…