bvfnbk
bvfnbk

Reputation: 61

Modify return type definition in generated WSDL of ladonized web service method

i have written a python web service using ladon web services (http://ladonize.org) and i want to access the SOAP interface using Java and Axis2.

I have successfully tested the WS using python and the SUDS client library.

Calling a remote service method works until the return type is converted. The ladon generated WSDL contains the following type definition:

<xsd:complexType name="Sensor">
    <xsd:sequence>
        <xsd:element maxOccurs="1" minOccurs="1" name="description" type="xsd:string"/>
        <xsd:element maxOccurs="1" minOccurs="1" name="host" type="xsd:string"/> 
        <xsd:element maxOccurs="1" minOccurs="1" name="sensorId" type="xsd:long"/>
        <xsd:element maxOccurs="1" minOccurs="1" name="service" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

The sent SOAP request (captured with tcpmon) is

<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Body>
            <ns1:create xmlns:ns1="urn:SensorService">
                <hostId>testHost</hostId>
                <serviceId>testService/serviceId>
                <description>testDescription</description>
            </ns1:create>
    </soapenv:Body>
</soapenv:Envelope>

The corresponding response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:ns="urn:SensorService" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <ns:createResponse>
            <result>
                <sensorId>16</sensorId>
                <host>testHost</host>
                <description>testDescription</description>
                <service>testService</service>
            </result>
        </ns:createResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Basically, the problem is the sequence of the elements in the result type. The xsd description requires

  1. description
  2. host
  3. sensorId
  4. service

but the response does not match this sequence thus leading to an Axis2 ADBException : Unexpected subelement sensorId. It works perfectly fine, when i

  1. manually download the WSDL file and
  2. change the type definition of the return type to match the sequence actually returned in the response, and
  3. regenerate the service stubs (using a Maven plugin) from the modified file.

The service stubs are automatically generated using the maven plugin and subsequently included into the project as dependency.

I'd like to avoid this manual step. Is it possible to modify the export sequence on the server side?

The type definition appears to list the elements in lexicographic sequence but the response is in another, different sequence.

It appeared first that the WSDL response type adheres to the sequence in which the attributes were defined in the original python return type definition. I've changed this sequence but it had no effect (i've stopped the server before i installed the updated package).

Many thanks in advance,

bvfnbk

Upvotes: 1

Views: 790

Answers (0)

Related Questions