axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hernan Silberman <hsilb...@pdi.com>
Subject Serialization problem...
Date Fri, 08 Apr 2005 18:10:23 GMT

Hi everyone, I'm new to Axis and am trying to write a simple Axis cpp client.  
I've been able to write a client for a service that returns a single xsd:string 
instance, but I'm having trouble extending the example to have it return a 
"list" of strings.  In the WSDL for the service, this list is defined as the 
following comlexType:

<xsd:complexType name="levelList">
  <xsd:sequence>
   <xsd:element name="myLevels" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
  </xsd:sequence>
</xsd:complexType>

I'm building my cpp client stubs using the java code generator, WSDL2Ws.  It 
builds a nice set of cpp code which I can build and test with a client program:

int main()
{
    try {
      LevelsService* theService =
        new LevelsService("http://localhost:8080/nile/services/LevelsService");
      levelList* theLevelList = theService->getFxLevelsForShot("PROD","sq","scene");
      if( NULL==theLevelList )
      {
          cout << "theLevelList is null." << endl;
          return 1;
      }
    } catch(AxisException& e) {
//omitted
}

The problem I'm having is that theLevelList returned by the 
Axis-generated LevelsService stub is always Null.  I've written a client for 
this service in Java and Perl and they're properly deserializing the two 
hardcoded strings that the server currently responds with.

I'm using Axis 1.5 alpha.

Here's the SOAP request message that the cpp client sends:

<?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 server responds with this SOAP response, which looks right to me:

<?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 href="#id0"/>
         </ns1:getFxLevelsForShotResponse>
         <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:levelList" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns2="http://www.dreamworks.com/LevelService.xsd">
            <myLevels xsi:type="xsd:string">Level 1</myLevels>
            <myLevels xsi:type="xsd:string">Level 2</myLevels>
         </multiRef>
      </soapenv:Body>
   </soapenv:Envelope>

Please let me know if you see my error.  I'm guessing it might be something 
nonstandard I'm doing in the WSDL, so here it is for good measure:

<?xml version="1.0"?>
<definitions
    name="LevelsService"
    targetNamespace="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:tns="http://www.dreamworks.com/LevelService.wsdl"
    xmlns:typens="http://www.dreamworks.com/LevelService.xsd"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <!-- type defs -->
  <types>
      <xsd:schema targetNamespace="http://www.dreamworks.com/LevelService.xsd"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <xsd:complexType name="levelList">
        <xsd:sequence>
            <xsd:element name="myLevels" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd: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" type="typens:levelList"/>
  </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>

thanks for your help.
Hernan


Mime
View raw message