Can't return class instance from WebMethod

R

Ryan Bingham

I'm unable to return a complex object from an XML Web
Service. Whenever I do, the client which consumes my web
service sees the "Subject" matter in it's debug output
window.

Any Web service method that I have which returns a
pointer to a class object always fails on the client
attempting to consume my web service. The method
actually succeeds in my web service, but the client
always gets an object return value that is full of
garbage. When debugging the C++ client, the following
message appears in the Visual Studio .NET C++ Output
window:

ATLSOAP: CSoapRootHandler::CheckEndElement -- invalid
number of elements for parameter/field

The only other interesting piece of information is that
if I completely fill in one of the objects defined below,
remove the second NULL object from the WSDL definition,
rebuild the client with the new WSDL, everything returns
fine. If either one of the two objects defined below is
returned as NULL, I get the garbage return value
problem. Why can't I have a return value that contains
pointers to 2 (or more) other internal objects????

FYI: My return value that has the problem is defined as
follows (WSDL)
<s:complexType name="CwsDefinePlanResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="_success" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1"
name="_CmdResponseType" type="s:int" />
<s:element minOccurs="1" maxOccurs="1"
name="_CmdResponseCode" type="s:int" />
<s:element minOccurs="0" maxOccurs="1"
name="_reasonForFailure" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="_definedDCP" nillable="true"
type="s0:CwsDefinedDCP" />
<s:element minOccurs="0" maxOccurs="1"
name="_unauthorizedOperation" nillable="true"
type="s0:CwsUnauthorizedOperation" />
</s:sequence>
</s:complexType>
<s:complexType name="CwsDefinedDCP">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="_planId" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="_timeDefined" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="_definedBy" type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="CwsUnauthorizedOperation">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="_description" nillable="true" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="_requiredPrivilege" nillable="true"
type="s:string" />
</s:sequence>
</s:complexType>

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top