axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hawkins <HAWKI...@uk.ibm.com>
Subject Re: deserialization help...
Date Tue, 12 Apr 2005 10:36:56 GMT
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 <hsilberm@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>




Mime
View raw message