Skip to main content

Axis2 to Metro conversion adds new elements

3 replies [Last post]
billybacon
Offline
Joined: 2009-02-03
Points: 0

We recently converted/migrated an existing Axis2 webservice over to Metro and it all deploys successfully. We've encountered an issue during testing because the soap request/response structure is slightly different.

The original request when deployed in Axis2:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="GetBookInfoByISBN">
<soapenv:Header/>
<soapenv:Body>
<get:GetBookInfoByISBN>
<get:ISBN>043396399747</get:ISBN>
<get:LoginName>xxxxx</get:LoginName>
<get:LoginPassword>xxxxx</get:LoginPassword>
</get:GetBookInfoByISBN>
</soapenv:Body>
</soapenv:Envelope>

The request in Metro is now:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.midwesttapes.com/" xmlns:inv="http://www.iii.com/InventoryExpress">
<soapenv:Header/>
<soapenv:Body>
<ser:GetBookInfoByISBN>
<arg0>
<GetBookInfoByISBN>
<inv:ISBN>?</inv:ISBN>
<inv:CustomerAccount>?</inv:CustomerAccount>
<inv:CustomerSubAccount>?</inv:CustomerSubAccount>
<inv:LoginName>?</inv:LoginName>
<inv:LoginPassword>?</inv:LoginPassword>
</GetBookInfoByISBN>
</arg0>
</ser:GetBookInfoByISBN>
</soapenv:Body>
</soapenv:Envelope>

Notice there there are two additional elements in the structure that are throwing off the request accepted and causing exceptions when the request _does not_ have:
<arg0>
<GetBookInfoByISBN>

Here is the WSDL for this web service:

<wsdl:definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:meta="GetBookInfoByISBN"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:impl="GetBookInfoByISBN"
targetNamespace="GetBookInfoByISBN">

<wsdl:types>
<xsd:schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="GetBookInfoByISBN" schemaLocation="meta.xsd"/>
</xsd:schema>
</wsdl:types>

<xsd:annotation>
<xsd:documentation>
The Dynix Book Information Webservice
Authored by Byers Parsons

Aug 10, 2003 - version 1.1

Refactored for BWI compatibility: changed name, case, and order of message parts.

Feb 17, 2003 - version 1.0 - Initial release

This web service gets data (see meta.xsd) about a book by ISBN.
</xsd:documentation>
</xsd:annotation>

<wsdl:message name="GetBookInfoByISBNRequest">
<wsdl:part name="Parameters" element="meta:GetBookInfoByISBN"/>
</wsdl:message>
<wsdl:message name="GetBookInfoByISBNResponse">
<wsdl:part name="Body" element="meta:GetBookInfoByISBNResponse"/>
</wsdl:message>

<wsdl:portType name="BookInfoPortType">
<wsdl:operation name="GetBookInfoByISBN">
<wsdl:input name="GetBookInfoByISBNRequest" message="impl:GetBookInfoByISBNRequest"/>
<wsdl:output name="GetBookInfoByISBNResponse" message="impl:GetBookInfoByISBNResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="BookInfoPortSoapBinding" type="impl:BookInfoPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetBookInfoByISBN">
<wsdlsoap:operation soapAction="GetBookInfoByISBN/GetBookInfoByISBN" style="document"/>
<wsdl:input>
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="BookInfoService">
<wsdl:port name="BookInfoPort" binding="impl:BookInfoPortSoapBinding">
<wsdlsoap:address location="http://@HOSTNAME@/services/BookInfoService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Does anyone know how I can get the structure back to the way it was in Axis2, without the <arg0> and <GetBookInfoByISBN> elements?

Thanks for any help!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
billybacon
Offline
Joined: 2009-02-03
Points: 0

I've tried annotating the web service method with

@WebMethod
@WebResult(name="")
public SearchByISBNResponse searchByISBN(@WebParam(name="") SearchByISBN searchParam)

This seems to help with the soap request in removing the arg0 but the web service throws a NullPointerException when this method is called because the searchParam is null and never bound to.

Does anyone have any ideas as to how I can resolve this issue?

gmazza
Offline
Joined: 2005-01-14
Points: 0

I responded via Nabble, which doesn't propagate to this forum still apparently: http://metro.1045641.n5.nabble.com/Axis2-to-Metro-conversion-adds-new-el...

Glen

billybacon
Offline
Joined: 2009-02-03
Points: 0

Thanks for the response Glen, I appreciate it!

It's interesting you mentioned that soapAction b/c after posting to this forum I tried exactly what you asked and it made no different. The additional <GetBookInfoByISBN> element is still inserted into the soap request structure. For example:

I changed this

<wsdlsoap:operation soapAction="GetBookInfoByISBN/GetBookInfoByISBN" style="document"/>

To this:

<wsdlsoap:operation soapAction="GetBookInfoByISBN" style="document"/>

Do you know if I can fix these issues I've discussed with annotations? I was able to get rid of the <arg0> element in the soap request but that then disrupts the service method parameter from binding. So my service method then throws a NullPointerException b/c the parameter it's expected to use is null.

Thanks so much for your help.