Can't return class instance from WebMethod

Discussion in 'ASP .Net Web Services' started by Ryan Bingham, Aug 11, 2003.

  1. Ryan Bingham

    Ryan Bingham Guest

    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>

    ..
     
    Ryan Bingham, Aug 11, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sridhar R
    Replies:
    14
    Views:
    1,457
    =?iso-8859-1?Q?Fran=E7ois?= Pinard
    Feb 10, 2004
  2. Gerard Flanagan
    Replies:
    3
    Views:
    497
    Terry Hancock
    Nov 19, 2005
  3. Sandra-24
    Replies:
    18
    Views:
    1,942
    Steve Holden
    Apr 29, 2006
  4. Martin P. Hellwig
    Replies:
    1
    Views:
    389
    Martin P. Hellwig
    Mar 26, 2010
  5. Guest
    Replies:
    1
    Views:
    186
    Brock Allen
    May 25, 2005
Loading...

Share This Page