You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Hernan Silberman <hs...@pdi.com> on 2005/04/11 19:40:00 UTC

deserialization help...

I'm still having trouble writing a client program that returns a collection of 
custum complex type instances from an Axis Java web service.  Fortunately, I 
have complete control over the server and I've been experimenting with different 
WSDL formats.  My goal is to find the WSDL document that allows me to build the 
C++ client side bindings using the org.apache.axis.wsdl.wsdl2ws.WSDL2Ws code 
generator.

Currently, I'm able to build what looks like a sensible set of client side C++ 
classes for using my simple web service and a handcoded test program:

int main()
{
 try {
  LevelsService* theService =
     new LevelsService("http://localhost:8080/nile/services/LevelsService");
  level_Array theLevelList = theService->getFxLevelsForShot("MAD","sq100","s1");
  cout << "LevelsService returned: " << theLevelList.m_Size << " levels." << endl;
  } catch(AxisException& e) {
  // etc.

This client calls a simple operation "getFxLevelsForShot" which takes three 
strings and returns an array of custom types called "level".  The service is 
returning two hardcoded level instances, and the client builds two level 
instances, but the two string attributes of the returned level instances 
(name and type) are null.  I've poked around in gdb and added debug stmts to the 
AxisCPP generated deserializer.  Basically, these two getElementAsString() calls 
are returning NULL:

int Axis_DeSerialize_level(level* param, IWrapperSoapDeSerializer* pIWSDZ)
{
        param->name = pIWSDZ->getElementAsString("name",0);
        param->type = pIWSDZ->getElementAsString("type",0);
        return pIWSDZ->getStatus();
}


Here's the WSDL type definition:

  <types>
    <xsd:schema targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
                xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
                xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="level">
        <sequence>
          <element name="name" type="string"/>
          <element name="type" type="string"/>
        </sequence>
      </complexType>
                                                                                                                                                             
      <complexType name="arrayOfLevel">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="tns:level[]"/>
          </restriction>
        </complexContent>
      </complexType>
    </xsd:schema>
  </types>

A Java client I wrote using Axis Java works fine for this WSDL.  I've tried 
several different variations of the WSDL and still no dice.  Please let me know 
if you see my error, I'm new to this and running out of ideas.

Here are the pertinent details (I'm using axis-c-1.5-alpha).  Any pointers you 
can provide are tremendously appreciated.

thanks Much...
Hernan

-------- The SOAP request:
<?xml version='1.0' encoding='utf-8' ?>
   <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
         <ns1:getFxLevelsForShot xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl">
            <projectShortName xsi:type="xsd:string">MAD</projectShortName>
            <ShotName xsi:type="xsd:string">sq100</ShotName>
            <SequenceName xsi:type="xsd:string">s1</SequenceName>
         </ns1:getFxLevelsForShot>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

-------- The SOAP response:
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <ns1:getFxLevelsForShotResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl">
            <theFxLevels soapenc:arrayType="ns1:arrayOfLevel[2]" 
xsi:type="soapenc:Array" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
               <item href="#id0"/>
               <item href="#id1"/>
            </theFxLevels>
         </ns1:getFxLevelsForShotResponse>
         <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns2:Level" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns2="http://www.dreamworks.com/LevelService.wsdl">
            <name xsi:type="xsd:string">Dust</name>
            <type xsi:type="xsd:string">3D EFX</type>
         </multiRef>
         <multiRef id="id1" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns3:Level" xmlns:ns3="http://www.dreamworks.com/LevelService.wsdl" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <name xsi:type="xsd:string">Fire</name>
            <type xsi:type="xsd:string">3D EFX</type>
         </multiRef>
      </soapenv:Body>
   </soapenv:Envelope>

------- The complete WSDL document:
<?xml version="1.0"?>

<definitions
    name="LevelsService"
    targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

  <!-- type defs -->
  <types>
    <xsd:schema targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
                xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
                xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="level">
        <sequence>
          <element name="name" type="string"/>
          <element name="type" type="string"/>
        </sequence>
      </complexType>

      <complexType name="arrayOfLevel">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="tns:level[]"/>
          </restriction>
        </complexContent>
      </complexType>
    </xsd:schema>
  </types>

  <!-- message declns -->
  <message name="getFxLevelsForShotRequest">
    <part name="projectShortName" type="xsd:string"/>
    <part name="SequenceName" type="xsd:string"/>
    <part name="ShotName" type="xsd:string"/>
  </message>

  <message name="getFxLevelsForShotResponse">
    <part name="theFxLevels"
          xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl"
          type="ns1:arrayOfLevel"/>
  </message>
  <!-- port type declns -->
  <portType name="LevelsService">
    <operation name="getFxLevelsForShot">
      <input message="tns:getFxLevelsForShotRequest"/>
      <output message="tns:getFxLevelsForShotResponse"/>
    </operation>
  </portType>

  <!-- binding declns -->
  <binding name="LevelsXMLServiceSOAPBinding" type="tns:LevelsService">
    <soap:binding style="rpc"
                  transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getFxLevelsForShot">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="encoded"
                   namespace="http://www.dreamworks.com/LevelService.wsdl"
                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </input>
      <output>
        <soap:body use="encoded"
                   namespace="http://www.dreamworks.com/LevelService.wsdl"
                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>
  </binding>

  <!-- service decln -->
  <service name="LevelsXMLService">
    <port name="LevelsService" binding="tns:LevelsXMLServiceSOAPBinding">
      <soap:address 
location="http://localhost:8080/nile/services/LevelsService"/>
    </port>
  </service>

</definitions>



Re: deserialization help...

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Hi,
    Your C++ client is failing because the server response contains
href/multiref (e.g. <item href="#id0"/>)
    This is nothing wrong with the server, but Axis C++ does not
support href/multiref. Please see
http://issues.apache.org/jira/browse/AXISCPP-111 for more details.
Also note that this URL has some info on how to disable href/multiref
in Axis Java. If you disable href/multiref on server side, then the
client may be able to deserialize.

Thanks,
Samisa...

On Apr 11, 2005 5:40 PM, Hernan Silberman <hs...@pdi.com> wrote:
> 
> I'm still having trouble writing a client program that returns a collection of
> custum complex type instances from an Axis Java web service.  Fortunately, I
> have complete control over the server and I've been experimenting with different
> WSDL formats.  My goal is to find the WSDL document that allows me to build the
> C++ client side bindings using the org.apache.axis.wsdl.wsdl2ws.WSDL2Ws code
> generator.
> 
> Currently, I'm able to build what looks like a sensible set of client side C++
> classes for using my simple web service and a handcoded test program:
> 
> int main()
> {
>  try {
>   LevelsService* theService =
>      new LevelsService("http://localhost:8080/nile/services/LevelsService");
>   level_Array theLevelList = theService->getFxLevelsForShot("MAD","sq100","s1");
>   cout << "LevelsService returned: " << theLevelList.m_Size << " levels." << endl;
>   } catch(AxisException& e) {
>   // etc.
> 
> This client calls a simple operation "getFxLevelsForShot" which takes three
> strings and returns an array of custom types called "level".  The service is
> returning two hardcoded level instances, and the client builds two level
> instances, but the two string attributes of the returned level instances
> (name and type) are null.  I've poked around in gdb and added debug stmts to the
> AxisCPP generated deserializer.  Basically, these two getElementAsString() calls
> are returning NULL:
> 
> int Axis_DeSerialize_level(level* param, IWrapperSoapDeSerializer* pIWSDZ)
> {
>         param->name = pIWSDZ->getElementAsString("name",0);
>         param->type = pIWSDZ->getElementAsString("type",0);
>         return pIWSDZ->getStatus();
> }
> 
> Here's the WSDL type definition:
> 
>   <types>
>     <xsd:schema targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
>                 xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
>                 xmlns="http://www.w3.org/2001/XMLSchema">
>       <complexType name="level">
>         <sequence>
>           <element name="name" type="string"/>
>           <element name="type" type="string"/>
>         </sequence>
>       </complexType>
> 
>       <complexType name="arrayOfLevel">
>         <complexContent>
>           <restriction base="soapenc:Array">
>             <attribute ref="soapenc:arrayType" wsdl:arrayType="tns:level[]"/>
>           </restriction>
>         </complexContent>
>       </complexType>
>     </xsd:schema>
>   </types>
> 
> A Java client I wrote using Axis Java works fine for this WSDL.  I've tried
> several different variations of the WSDL and still no dice.  Please let me know
> if you see my error, I'm new to this and running out of ideas.
> 
> Here are the pertinent details (I'm using axis-c-1.5-alpha).  Any pointers you
> can provide are tremendously appreciated.
> 
> thanks Much...
> Hernan
> 
> -------- The SOAP request:
> <?xml version='1.0' encoding='utf-8' ?>
>    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <SOAP-ENV:Body>
>          <ns1:getFxLevelsForShot xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl">
>             <projectShortName xsi:type="xsd:string">MAD</projectShortName>
>             <ShotName xsi:type="xsd:string">sq100</ShotName>
>             <SequenceName xsi:type="xsd:string">s1</SequenceName>
>          </ns1:getFxLevelsForShot>
>       </SOAP-ENV:Body>
>    </SOAP-ENV:Envelope>
> 
> -------- The SOAP response:
> <?xml version="1.0" encoding="UTF-8"?>
>    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <soapenv:Body>
>          <ns1:getFxLevelsForShotResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl">
>             <theFxLevels soapenc:arrayType="ns1:arrayOfLevel[2]"
> xsi:type="soapenc:Array"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
>                <item href="#id0"/>
>                <item href="#id1"/>
>             </theFxLevels>
>          </ns1:getFxLevelsForShotResponse>
>          <multiRef id="id0" soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="ns2:Level" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns2="http://www.dreamworks.com/LevelService.wsdl">
>             <name xsi:type="xsd:string">Dust</name>
>             <type xsi:type="xsd:string">3D EFX</type>
>          </multiRef>
>          <multiRef id="id1" soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="ns3:Level" xmlns:ns3="http://www.dreamworks.com/LevelService.wsdl"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
>             <name xsi:type="xsd:string">Fire</name>
>             <type xsi:type="xsd:string">3D EFX</type>
>          </multiRef>
>       </soapenv:Body>
>    </soapenv:Envelope>
> 
> ------- The complete WSDL document:
> <?xml version="1.0"?>
> 
> <definitions
>     name="LevelsService"
>     targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
>     xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
>     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>     xmlns="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> 
>   <!-- type defs -->
>   <types>
>     <xsd:schema targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
>                 xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
>                 xmlns="http://www.w3.org/2001/XMLSchema">
>       <complexType name="level">
>         <sequence>
>           <element name="name" type="string"/>
>           <element name="type" type="string"/>
>         </sequence>
>       </complexType>
> 
>       <complexType name="arrayOfLevel">
>         <complexContent>
>           <restriction base="soapenc:Array">
>             <attribute ref="soapenc:arrayType" wsdl:arrayType="tns:level[]"/>
>           </restriction>
>         </complexContent>
>       </complexType>
>     </xsd:schema>
>   </types>
> 
>   <!-- message declns -->
>   <message name="getFxLevelsForShotRequest">
>     <part name="projectShortName" type="xsd:string"/>
>     <part name="SequenceName" type="xsd:string"/>
>     <part name="ShotName" type="xsd:string"/>
>   </message>
> 
>   <message name="getFxLevelsForShotResponse">
>     <part name="theFxLevels"
>           xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl"
>           type="ns1:arrayOfLevel"/>
>   </message>
>   <!-- port type declns -->
>   <portType name="LevelsService">
>     <operation name="getFxLevelsForShot">
>       <input message="tns:getFxLevelsForShotRequest"/>
>       <output message="tns:getFxLevelsForShotResponse"/>
>     </operation>
>   </portType>
> 
>   <!-- binding declns -->
>   <binding name="LevelsXMLServiceSOAPBinding" type="tns:LevelsService">
>     <soap:binding style="rpc"
>                   transport="http://schemas.xmlsoap.org/soap/http"/>
>     <operation name="getFxLevelsForShot">
>       <soap:operation soapAction=""/>
>       <input>
>         <soap:body use="encoded"
>                    namespace="http://www.dreamworks.com/LevelService.wsdl"
>                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>       </input>
>       <output>
>         <soap:body use="encoded"
>                    namespace="http://www.dreamworks.com/LevelService.wsdl"
>                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>       </output>
>     </operation>
>   </binding>
> 
>   <!-- service decln -->
>   <service name="LevelsXMLService">
>     <port name="LevelsService" binding="tns:LevelsXMLServiceSOAPBinding">
>       <soap:address
> location="http://localhost:8080/nile/services/LevelsService"/>
>     </port>
>   </service>
> 
> </definitions>
> 
>

Re: deserialization help...

Posted by Hernan Silberman <hs...@pdi.com>.
You're right!  I wasn't doing doc/literal, I was still using an rpc style in the 
WSDL.  Changing it solved the problem and my client is having a meaningful 
conversation with the server.

Thanks everyone for your help!
Hernan

On Wed, 13 Apr 2005, Adrian Dick wrote:

> Hi,
> 
> As you comment below, it is suspicious that the generated code is looking
> for the "result" element, as defined in the WSDL, but the SOAP response
> doesn't contain such an element.  It is probably worth checking your server
> has been correctly deployed from the same version of the WSDL.
> 
> Also, I notice from your WSDL that you're actually trying to use an
> rpc/literal web service.    Was that your intention?
> (snippet from WSDL binding)
> >    <soapbind:binding
> >     transport="http://schemas.xmlsoap.org/soap/http/"
> >     style="rpc"/>
> 
> If, as you have said in the past, you have control over the server, I'd
> recommend you try with doc/literal.
> 
> Regards,
> Adrian


Re: deserialization help...

Posted by Adrian Dick <ad...@uk.ibm.com>.
Hi,

As you comment below, it is suspicious that the generated code is looking
for the "result" element, as defined in the WSDL, but the SOAP response
doesn't contain such an element.  It is probably worth checking your server
has been correctly deployed from the same version of the WSDL.

Also, I notice from your WSDL that you're actually trying to use an
rpc/literal web service.    Was that your intention?
(snippet from WSDL binding)
>    <soapbind:binding
>     transport="http://schemas.xmlsoap.org/soap/http/"
>     style="rpc"/>

If, as you have said in the past, you have control over the server, I'd
recommend you try with doc/literal.

Regards,
Adrian
_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)
WebSphere MQ and ESB Development
Tel: +44-(0)-1962-819212
Notes: Adrian Dick/UK/IBM@IBMGB

Hernan Silberman <hs...@pdi.com> wrote on 13/04/2005 02:19:27:

>
> More information:  It looks like my WSDL-generated Axis cpp client does
the
> following:
>
> I call LevelsServicePortType::getFxLevelsForShot()
> which calls SoapDeserializer.getCmplxObj()
> which calls Axis_DeSerialize_tLevelCollection
> which does a SoapDeserializer.getCmplxArry()
> which calls Axis_Create_tLevelCollection() with a size of 0
>
> hope this helps.
> thanks again...
> Hernan
>
>
> On Tue, 12 Apr 2005, Hernan Silberman wrote:
>
> >
> > > Given you have complete control of the server I would suggest you
> > > re-deploy your web service as doc/literal.
> > > doc/literal is supported in AxisCPP far better due to our commitment
to
> > > being ws-i compliant.
> >
> > Thanks for the tip, I've discovered ws-i.org and I'm doing my bestto
follow
> > their guidelines as well.
> >
> > I'm doing doc/literal for my service now and I've turned off
> multipart encoding
> > on my Axis Java service.  I know I'm getting close, but something
> is still wrong
> > with my WSDL.  My test client is getting a NULL response from the
generated
> > stub:
> >
> > int main()
> > {
> >     try {
> >       LevelsServicePortType* theService =
> >    new LevelsServicePortType("http://localhost:
> 8080/nile/services/LevelsServicePort");
> >       tLevelCollection* thePtr = theService->getFxLevelsForShot();
> >       if( NULL==thePtr )
> >       {
> >      cout << "thePtr is null" << endl;
> >       }
> >     } catch(AxisException& e) {
> > // etc.
> >
> > Here's the new SOAP response:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >   <soapenv:Body>
> >      <getFxLevelsForShotResponse xmlns="http://www.dreamworks.
> com/LevelService/">
> >         <ns1:LevelCollectionResponse xmlns:ns1="http://www.
> dreamworks.com/nile/schema/">
> >            <ns1:Element>
> >               <ns1:Prod>MAD</ns1:Prod>
> >               <ns1:Name>Dust</ns1:Name>
> >            </ns1:Element>
> >            <ns1:Element>
> >               <ns1:Prod>MAD</ns1:Prod>
> >               <ns1:Name>Fire</ns1:Name>
> >            </ns1:Element>
> >         </ns1:LevelCollectionResponse>
> >      </getFxLevelsForShotResponse>
> >   </soapenv:Body>
> > </soapenv:Envelope>
> >
> > This generated call to getCmplxObject below returns null.  I don't see
the
> > string literal "result" in the SOAP response above, though it isin
> the WSDL.
> > Seems suspicious.
> >
> > if(AXIS_SUCCESS == m_pCall->checkMessage("getFxLevelsForShotResponse",
"
> http://www.dreamworks.com/LevelService/"))
> > {
> >   pReturn =
> >   (tLevelCollection*)m_pCall->getCmplxObject((void*)
> >   Axis_DeSerialize_tLevelCollection,
> >   (void*) Axis_Create_tLevelCollection,
> >   (void*) Axis_Delete_tLevelCollection,
> >   "result", 0);
> > }
> >
> > I appreciate any help in finding my error.
> > thanks again,
> > Hernan
> >
> > Here's the WSDL the cpp stub is generated from:
> >
> > <?xml version="1.0"?>
> >
> > <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
> >  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >  xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
> >  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> >  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >  xmlns:tns="http://www.dreamworks.com/LevelService/"
> >  targetNamespace="http://www.dreamworks.com/LevelService/"
> >  xmlns:typens="http://www.dreamworks.com/nile/schema/">
> >
> >  <types>
> >    <xsd:schema targetNamespace="http://www.dreamworks.com/nile/schema/"
> >        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >        elementFormDefault="qualified"
> >        attributeFormDefault="unqualified">
> >
> >       <xsd:element name="LevelCollectionResponse" type="typens:
> tLevelCollection"/>
> >       <xsd:complexType name="tLevelCollection">
> >          <xsd:sequence>
> >             <xsd:element name="Element" type="typens:tLevel"
> minOccurs="0" maxOccurs="unbounded"/>
> >          </xsd:sequence>
> >       </xsd:complexType>
> >
> >       <xsd:complexType name="tLevel">
> >         <xsd:sequence>
> >            <xsd:element name="Prod" type="xsd:string"/>
> >            <xsd:element name="Name" type="xsd:string"/>
> >         </xsd:sequence>
> >       </xsd:complexType>
> >
> >    </xsd:schema>
> >  </types>
> >
> >  <!-- message declns -->
> >  <message name="getFxLevelsForShotRequest"/>
> >  <message name="getFxLevelsForShotResponse">
> >    <part name="result" element="typens:LevelCollectionResponse"/>
> >  </message>
> >
> >  <!-- port type declns -->
> >  <portType name="LevelsServicePortType">
> >    <operation name="getFxLevelsForShot">
> >      <input message="tns:getFxLevelsForShotRequest"/>
> >      <output message="tns:getFxLevelsForShotResponse"/>
> >    </operation>
> >  </portType>
> >
> >  <!-- binding declns -->
> >  <binding name="LevelsXMLServiceSOAPBinding" type="tns:
> LevelsServicePortType">
> >    <soapbind:binding
> >     transport="http://schemas.xmlsoap.org/soap/http/"
> >     style="rpc"/>
> >    <operation name="getFxLevelsForShot">
> >      <input name="getFxLevelsForShotRequest">
> >        <soapbind:body use="literal" namespace="http://www.
> dreamworks.com/LevelService/"/>
> >      </input>
> >      <output name="getFxLevelsForShotResponse">
> >        <soapbind:body use="literal" namespace="http://www.
> dreamworks.com/LevelService/"/>
> >      </output>
> >    </operation>
> >  </binding>
> >
> >  <service name="LevelsXMLService">
> >     <port name="LevelsServicePort" binding="tns:
> LevelsXMLServiceSOAPBinding">
> >       <soap:address location="http://localhost:
> 8080/nile/services/LevelsService"/>
> >     </port>
> >  </service>
> >
> > </definitions>
> >
> >
>
> --
> Hernan Silberman
> PDI/Dreamworks
> ext.29162 / 650-562-9162 / cell 415-810-5809
> text pager: page-hsilberm@anim.dreamworks.com
>


Re: deserialization help...

Posted by Hernan Silberman <hs...@pdi.com>.
More information:  It looks like my WSDL-generated Axis cpp client does the 
following:

I call LevelsServicePortType::getFxLevelsForShot()
which calls SoapDeserializer.getCmplxObj()
which calls Axis_DeSerialize_tLevelCollection
which does a SoapDeserializer.getCmplxArry()
which calls Axis_Create_tLevelCollection() with a size of 0

hope this helps.
thanks again...
Hernan


On Tue, 12 Apr 2005, Hernan Silberman wrote:

> 
> > Given you have complete control of the server I would suggest you 
> > re-deploy your web service as doc/literal. 
> > doc/literal is supported in AxisCPP far better due to our commitment to 
> > being ws-i compliant.
> 
> Thanks for the tip, I've discovered ws-i.org and I'm doing my best to follow 
> their guidelines as well.
> 
> I'm doing doc/literal for my service now and I've turned off multipart encoding 
> on my Axis Java service.  I know I'm getting close, but something is still wrong 
> with my WSDL.  My test client is getting a NULL response from the generated 
> stub:
> 
> int main()
> {
>     try {
>       LevelsServicePortType* theService =
> 	new LevelsServicePortType("http://localhost:8080/nile/services/LevelsServicePort");
>       tLevelCollection* thePtr = theService->getFxLevelsForShot();
>       if( NULL==thePtr )
>       {
> 	  cout << "thePtr is null" << endl;
>       }
>     } catch(AxisException& e) {
> // etc.
> 
> Here's the new SOAP response:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <soapenv:Body>
>      <getFxLevelsForShotResponse xmlns="http://www.dreamworks.com/LevelService/">
>         <ns1:LevelCollectionResponse xmlns:ns1="http://www.dreamworks.com/nile/schema/">
>            <ns1:Element>
>               <ns1:Prod>MAD</ns1:Prod>
>               <ns1:Name>Dust</ns1:Name>
>            </ns1:Element>
>            <ns1:Element>
>               <ns1:Prod>MAD</ns1:Prod>
>               <ns1:Name>Fire</ns1:Name>
>            </ns1:Element>
>         </ns1:LevelCollectionResponse>
>      </getFxLevelsForShotResponse>
>   </soapenv:Body>
> </soapenv:Envelope>
> 
> This generated call to getCmplxObject below returns null.  I don't see the 
> string literal "result" in the SOAP response above, though it isin the WSDL.  
> Seems suspicious.
> 
> if(AXIS_SUCCESS == m_pCall->checkMessage("getFxLevelsForShotResponse", "http://www.dreamworks.com/LevelService/"))
> {
>   pReturn = 
>   (tLevelCollection*)m_pCall->getCmplxObject((void*) 
>   Axis_DeSerialize_tLevelCollection,
>   (void*) Axis_Create_tLevelCollection,
>   (void*) Axis_Delete_tLevelCollection,
>   "result", 0);
> }
> 
> I appreciate any help in finding my error.
> thanks again,
> Hernan
> 
> Here's the WSDL the cpp stub is generated from:
> 
> <?xml version="1.0"?>
> 
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
>  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>  xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
>  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
>  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  xmlns:tns="http://www.dreamworks.com/LevelService/"
>  targetNamespace="http://www.dreamworks.com/LevelService/"
>  xmlns:typens="http://www.dreamworks.com/nile/schema/">
> 
>  <types>
>    <xsd:schema targetNamespace="http://www.dreamworks.com/nile/schema/"
>        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>        elementFormDefault="qualified"
>        attributeFormDefault="unqualified">
> 
>       <xsd:element name="LevelCollectionResponse" type="typens:tLevelCollection"/>
>       <xsd:complexType name="tLevelCollection">
>          <xsd:sequence>
>             <xsd:element name="Element" type="typens:tLevel" minOccurs="0" maxOccurs="unbounded"/>
>          </xsd:sequence>
>       </xsd:complexType>
> 
>       <xsd:complexType name="tLevel">
>         <xsd:sequence>
>            <xsd:element name="Prod" type="xsd:string"/>
>            <xsd:element name="Name" type="xsd:string"/>
>         </xsd:sequence>
>       </xsd:complexType>
> 
>    </xsd:schema>
>  </types>
> 
>  <!-- message declns -->
>  <message name="getFxLevelsForShotRequest"/>
>  <message name="getFxLevelsForShotResponse">
>    <part name="result" element="typens:LevelCollectionResponse"/>
>  </message>
> 
>  <!-- port type declns -->
>  <portType name="LevelsServicePortType">
>    <operation name="getFxLevelsForShot">
>      <input message="tns:getFxLevelsForShotRequest"/>
>      <output message="tns:getFxLevelsForShotResponse"/>
>    </operation>
>  </portType>
> 
>  <!-- binding declns -->
>  <binding name="LevelsXMLServiceSOAPBinding" type="tns:LevelsServicePortType">
>    <soapbind:binding 
>     transport="http://schemas.xmlsoap.org/soap/http/" 
>     style="rpc"/>
>    <operation name="getFxLevelsForShot">
>      <input name="getFxLevelsForShotRequest">
>        <soapbind:body use="literal" namespace="http://www.dreamworks.com/LevelService/"/>
>      </input>
>      <output name="getFxLevelsForShotResponse"> 
>        <soapbind:body use="literal" namespace="http://www.dreamworks.com/LevelService/"/>
>      </output>
>    </operation>
>  </binding>
> 
>  <service name="LevelsXMLService">
>     <port name="LevelsServicePort" binding="tns:LevelsXMLServiceSOAPBinding">
>       <soap:address location="http://localhost:8080/nile/services/LevelsService"/>
>     </port>
>  </service>
> 
> </definitions>
> 
> 

-- 
Hernan Silberman
PDI/Dreamworks
ext.29162 / 650-562-9162 / cell 415-810-5809
text pager: page-hsilberm@anim.dreamworks.com


Re: deserialization help...

Posted by Hernan Silberman <hs...@pdi.com>.
> Given you have complete control of the server I would suggest you 
> re-deploy your web service as doc/literal. 
> doc/literal is supported in AxisCPP far better due to our commitment to 
> being ws-i compliant.

Thanks for the tip, I've discovered ws-i.org and I'm doing my best to follow 
their guidelines as well.

I'm doing doc/literal for my service now and I've turned off multipart encoding 
on my Axis Java service.  I know I'm getting close, but something is still wrong 
with my WSDL.  My test client is getting a NULL response from the generated 
stub:

int main()
{
    try {
      LevelsServicePortType* theService =
	new LevelsServicePortType("http://localhost:8080/nile/services/LevelsServicePort");
      tLevelCollection* thePtr = theService->getFxLevelsForShot();
      if( NULL==thePtr )
      {
	  cout << "thePtr is null" << endl;
      }
    } catch(AxisException& e) {
// etc.

Here's the new SOAP response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
     <getFxLevelsForShotResponse xmlns="http://www.dreamworks.com/LevelService/">
        <ns1:LevelCollectionResponse xmlns:ns1="http://www.dreamworks.com/nile/schema/">
           <ns1:Element>
              <ns1:Prod>MAD</ns1:Prod>
              <ns1:Name>Dust</ns1:Name>
           </ns1:Element>
           <ns1:Element>
              <ns1:Prod>MAD</ns1:Prod>
              <ns1:Name>Fire</ns1:Name>
           </ns1:Element>
        </ns1:LevelCollectionResponse>
     </getFxLevelsForShotResponse>
  </soapenv:Body>
</soapenv:Envelope>

This generated call to getCmplxObject below returns null.  I don't see the 
string literal "result" in the SOAP response above, though it isin the WSDL.  
Seems suspicious.

if(AXIS_SUCCESS == m_pCall->checkMessage("getFxLevelsForShotResponse", "http://www.dreamworks.com/LevelService/"))
{
  pReturn = 
  (tLevelCollection*)m_pCall->getCmplxObject((void*) 
  Axis_DeSerialize_tLevelCollection,
  (void*) Axis_Create_tLevelCollection,
  (void*) Axis_Delete_tLevelCollection,
  "result", 0);
}

I appreciate any help in finding my error.
thanks again,
Hernan

Here's the WSDL the cpp stub is generated from:

<?xml version="1.0"?>

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:tns="http://www.dreamworks.com/LevelService/"
 targetNamespace="http://www.dreamworks.com/LevelService/"
 xmlns:typens="http://www.dreamworks.com/nile/schema/">

 <types>
   <xsd:schema targetNamespace="http://www.dreamworks.com/nile/schema/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       elementFormDefault="qualified"
       attributeFormDefault="unqualified">

      <xsd:element name="LevelCollectionResponse" type="typens:tLevelCollection"/>
      <xsd:complexType name="tLevelCollection">
         <xsd:sequence>
            <xsd:element name="Element" type="typens:tLevel" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
      </xsd:complexType>

      <xsd:complexType name="tLevel">
        <xsd:sequence>
           <xsd:element name="Prod" type="xsd:string"/>
           <xsd:element name="Name" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>

   </xsd:schema>
 </types>

 <!-- message declns -->
 <message name="getFxLevelsForShotRequest"/>
 <message name="getFxLevelsForShotResponse">
   <part name="result" element="typens:LevelCollectionResponse"/>
 </message>

 <!-- port type declns -->
 <portType name="LevelsServicePortType">
   <operation name="getFxLevelsForShot">
     <input message="tns:getFxLevelsForShotRequest"/>
     <output message="tns:getFxLevelsForShotResponse"/>
   </operation>
 </portType>

 <!-- binding declns -->
 <binding name="LevelsXMLServiceSOAPBinding" type="tns:LevelsServicePortType">
   <soapbind:binding 
    transport="http://schemas.xmlsoap.org/soap/http/" 
    style="rpc"/>
   <operation name="getFxLevelsForShot">
     <input name="getFxLevelsForShotRequest">
       <soapbind:body use="literal" namespace="http://www.dreamworks.com/LevelService/"/>
     </input>
     <output name="getFxLevelsForShotResponse"> 
       <soapbind:body use="literal" namespace="http://www.dreamworks.com/LevelService/"/>
     </output>
   </operation>
 </binding>

 <service name="LevelsXMLService">
    <port name="LevelsServicePort" binding="tns:LevelsXMLServiceSOAPBinding">
      <soap:address location="http://localhost:8080/nile/services/LevelsService"/>
    </port>
 </service>

</definitions>



Re: deserialization help...

Posted by John Hawkins <HA...@uk.ibm.com>.
Given you have complete control of the server I would suggest you 
re-deploy your web service as doc/literal. 
doc/literal is supported in AxisCPP far better due to our commitment to 
being ws-i compliant.






Hernan Silberman <hs...@pdi.com> 
11/04/2005 18:40
Please respond to
"Apache AXIS C User List"


To
axis-c-user@ws.apache.org
cc

Subject
deserialization help...







I'm still having trouble writing a client program that returns a 
collection of 
custum complex type instances from an Axis Java web service.  Fortunately, 
I 
have complete control over the server and I've been experimenting with 
different 
WSDL formats.  My goal is to find the WSDL document that allows me to 
build the 
C++ client side bindings using the org.apache.axis.wsdl.wsdl2ws.WSDL2Ws 
code 
generator.

Currently, I'm able to build what looks like a sensible set of client side 
C++ 
classes for using my simple web service and a handcoded test program:

int main()
{
 try {
  LevelsService* theService =
     new LevelsService("http://localhost:8080/nile/services/LevelsService
");
  level_Array theLevelList = 
theService->getFxLevelsForShot("MAD","sq100","s1");
  cout << "LevelsService returned: " << theLevelList.m_Size << " levels." 
<< endl;
  } catch(AxisException& e) {
  // etc.

This client calls a simple operation "getFxLevelsForShot" which takes 
three 
strings and returns an array of custom types called "level".  The service 
is 
returning two hardcoded level instances, and the client builds two level 
instances, but the two string attributes of the returned level instances 
(name and type) are null.  I've poked around in gdb and added debug stmts 
to the 
AxisCPP generated deserializer.  Basically, these two getElementAsString() 
calls 
are returning NULL:

int Axis_DeSerialize_level(level* param, IWrapperSoapDeSerializer* pIWSDZ)
{
        param->name = pIWSDZ->getElementAsString("name",0);
        param->type = pIWSDZ->getElementAsString("type",0);
        return pIWSDZ->getStatus();
}


Here's the WSDL type definition:

  <types>
    <xsd:schema targetNamespace="
http://www.dreamworks.com/LevelService.wsdl"
                xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
                xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="level">
        <sequence>
          <element name="name" type="string"/>
          <element name="type" type="string"/>
        </sequence>
      </complexType>
   
      <complexType name="arrayOfLevel">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" 
wsdl:arrayType="tns:level[]"/>
          </restriction>
        </complexContent>
      </complexType>
    </xsd:schema>
  </types>

A Java client I wrote using Axis Java works fine for this WSDL.  I've 
tried 
several different variations of the WSDL and still no dice.  Please let me 
know 
if you see my error, I'm new to this and running out of ideas.

Here are the pertinent details (I'm using axis-c-1.5-alpha).  Any pointers 
you 
can provide are tremendously appreciated.

thanks Much...
Hernan

-------- The SOAP request:
<?xml version='1.0' encoding='utf-8' ?>
   <SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
         <ns1:getFxLevelsForShot xmlns:ns1="
http://www.dreamworks.com/LevelService.wsdl">
            <projectShortName xsi:type="xsd:string">MAD</projectShortName>
            <ShotName xsi:type="xsd:string">sq100</ShotName>
            <SequenceName xsi:type="xsd:string">s1</SequenceName>
         </ns1:getFxLevelsForShot>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

-------- The SOAP response:
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <ns1:getFxLevelsForShotResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl">
            <theFxLevels soapenc:arrayType="ns1:arrayOfLevel[2]" 
xsi:type="soapenc:Array" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
               <item href="#id0"/>
               <item href="#id1"/>
            </theFxLevels>
         </ns1:getFxLevelsForShotResponse>
         <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns2:Level" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns2="http://www.dreamworks.com/LevelService.wsdl">
            <name xsi:type="xsd:string">Dust</name>
            <type xsi:type="xsd:string">3D EFX</type>
         </multiRef>
         <multiRef id="id1" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns3:Level" xmlns:ns3="
http://www.dreamworks.com/LevelService.wsdl" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <name xsi:type="xsd:string">Fire</name>
            <type xsi:type="xsd:string">3D EFX</type>
         </multiRef>
      </soapenv:Body>
   </soapenv:Envelope>

------- The complete WSDL document:
<?xml version="1.0"?>

<definitions
    name="LevelsService"
    targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

  <!-- type defs -->
  <types>
    <xsd:schema targetNamespace="
http://www.dreamworks.com/LevelService.wsdl"
                xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
                xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="level">
        <sequence>
          <element name="name" type="string"/>
          <element name="type" type="string"/>
        </sequence>
      </complexType>

      <complexType name="arrayOfLevel">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" 
wsdl:arrayType="tns:level[]"/>
          </restriction>
        </complexContent>
      </complexType>
    </xsd:schema>
  </types>

  <!-- message declns -->
  <message name="getFxLevelsForShotRequest">
    <part name="projectShortName" type="xsd:string"/>
    <part name="SequenceName" type="xsd:string"/>
    <part name="ShotName" type="xsd:string"/>
  </message>

  <message name="getFxLevelsForShotResponse">
    <part name="theFxLevels"
          xmlns:ns1="http://www.dreamworks.com/LevelService.wsdl"
          type="ns1:arrayOfLevel"/>
  </message>
  <!-- port type declns -->
  <portType name="LevelsService">
    <operation name="getFxLevelsForShot">
      <input message="tns:getFxLevelsForShotRequest"/>
      <output message="tns:getFxLevelsForShotResponse"/>
    </operation>
  </portType>

  <!-- binding declns -->
  <binding name="LevelsXMLServiceSOAPBinding" type="tns:LevelsService">
    <soap:binding style="rpc"
                  transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getFxLevelsForShot">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="encoded"
                   namespace="http://www.dreamworks.com/LevelService.wsdl"
                   encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/>
      </input>
      <output>
        <soap:body use="encoded"
                   namespace="http://www.dreamworks.com/LevelService.wsdl"
                   encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>
  </binding>

  <!-- service decln -->
  <service name="LevelsXMLService">
    <port name="LevelsService" binding="tns:LevelsXMLServiceSOAPBinding">
      <soap:address 
location="http://localhost:8080/nile/services/LevelsService"/>
    </port>
  </service>

</definitions>