Question

I'm trying to update my client from axis1.x to axis2-1.6.2 while the server side is left untouched. The web service is implemented on python by ZSI webservice platform. The client was generated successfully with the old wsdl file using WSDL2Java tool and XMLBeans databinding.

While sending request to the old webservice I encounter a problem,the new axis2 client creates request with missing xsi:type attribute which is expected by the old server and as a result the server returns Any cannot parse untyped element error.

The new old request looks like

<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:getSearchResult xmlns:ns1="http://www.iphrase.com/2003/11/oneStep/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<arg xsi:type="xsd:string">
test
</arg>
</ns1:getSearchResult>
</soapenv:Body>
</soapenv:Envelope>

while the new one is

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ones:getSearchResult xmlns:ones="http://www.iphrase.com/2003/11/oneStep/">
<arg>
test
</arg>
</ones:getSearchResult>
</soapenv:Body>
</soapenv:Envelope>

as you can see the "arg" param is missing xsi:type="xsd:string" , which I suppose the main problem.

Here more technical details:

The wsdl looks like

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:types="http://www.iphrase.com/2003/11/oneStep/encodedTypes"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:tns="http://www.iphrase.com/2003/11/oneStep/"
  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  targetNamespace="http://www.iphrase.com/2003/11/oneStep/"
  xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
  <xsd:schema targetNamespace="http://www.iphrase.com/2003/11/oneStep/encodedTypes">
    <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />


<xsd:simpleType name="arg">
  <xsd:restriction base="xsd:string">
  </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="out">
  <xsd:restriction base="xsd:string">
  </xsd:restriction>
</xsd:simpleType>

 </xsd:schema>
</types>
<message name="getSearchResultSoapIn">
  <part name="arg" type="types:arg"/>
</message>
<message name="getSearchResultSoapOut">
  <part name="searchResult" type="types:out"/>
</message>

<portType name="QueryServiceSoap">
  <operation name="getSearchResult">
    <input message="tns:getSearchResultSoapIn"/>
    <output message="tns:getSearchResultSoapOut"/>
  </operation>
</portType>
<binding name="QueryServiceSoap" type="tns:QueryServiceSoap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
  <operation name="getSearchResult">
    <soap:operation soapAction="http://www.iphrase.com/2003/11/oneStep/getSearchResult" style="rpc" />
    <input>
      <soap:body use="encoded" namespace="http://www.iphrase.com/2003/11/oneStep/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </input>
    <output>
      <soap:body use="encoded" namespace="http://www.iphrase.com/2003/11/oneStep/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
  </operation>
</binding>


<service name="QueryService">
  <port name="QueryServiceSoap" binding="tns:QueryServiceSoap">
      <soap:address location="http://9.148.51.231:8777/service" />
  </port>
</service>
</definitions>

Seems like axis2 for some reason omits xsi:type for primitive types, also I don't find xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance namespaces probably it's also related. I assume that working with Axis2 client doesn't requires to upgrade the server as well.

Can someone give a direction, Seems like any configuration issue but my knowledge around axis2 is very restricted. All attempts to find anything relevant on the web had no success.

Thanks a lot

Was it helpful?

Solution

In your WSDL, see where the binding section specifies style="document" and use="encoded"? This WSDL is specifying the document/encoded style, which is nonstandard and very unusual. This page describes the four styles (RPC vs document, encoded VS literal) and you'll see that the author doesn't spend any space on document/encoded.

Axis2 doesn't support rpc/encoded, and my guess is that it doesn't contain the bits needed to support document/encoded either. Your best bet is to add a new interface to this server which supports document/literal. Otherwise, you may be stuck using Axis for the client. Here is a page that talks about calling rpc/encoded services from a JAX-WS client. You may be able to adapt that to your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top