You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ANDREW MICONE <AM...@DEQ.IDAHO.GOV> on 2004/12/02 23:23:18 UTC

Java2WSDL: response mapped back to XML improperly

I'm using WSDL2Java to create a service consumed by a .NET client I can't change for a WSDL we're mandated to use. It has a service called "GetService" defined as follows in the WSDL (details omitted):

<complexType name="ArrayOfstring">
  <complexContent>
    <restriction base="SOAP-ENC:Array">
      <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
    </restriction>
  </complexContent>
</complexType>
<message name="GetServicesResponse">
  <part name="return" type="typens:ArrayOfstring"/>
</message>
<operation name="GetServices" parameterOrder="securityToken serviceType">
<documentation>Query services offered by the node</documentation>
  <input message="tns:GetServices"/>
  <output message="tns:GetServicesResponse"/>
</operation>

I'm just using the binding implementation stub to craft a response. The response from the Axis client is as follows:

<soapenv:Envelope>
<soapenv:Body>
<getServicesResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return soapenc:arrayType="soapenc:string[9]" xsi:type="soapenc:Array">
<item xsi:type="soapenc:string">PNWWQX.GetProjects</item>
...

Which the .NET client says is an illegal response. ("There is an error in the XML document (1,384)"). A response from another server which it likes is:

<soapenv:Envelope>
<soapenv:Body>
<ns1:GetServicesResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[8]">
<item>GetFacilityByName</item>

There are only three differences between the messages, which I rank in decreasing likelihood they are causing the problem:

1) That the GetServicesResponse operation defined in the WSDL is sent back as getServicesResponse with an initial lower-case letter.

2) That the response in the second is in a user namespace.

3) The additional type information provided in the first response.

I'm thinking the most likely reason is the initial lower-case letter. How can I fix this so the response in the first message looks like the second message using WSDL2Java (i.e. without writing my own customized deserializer for the array). -- Andy