dirgee
dirgee

Reputation: 21

Apache Axis response without type

I have a web service client using axis. It's using document/literal style and supposed to have void response however the server insists on sending header response inside of soap body as following

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <SOAP-ENV:Code>
            <SOAP-ENV:Value>HTTP/1.1 200 OK</SOAP-ENV:Value>
        </SOAP-ENV:Code>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And of course client is raising deserializer exception as following

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
    at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
    at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
    at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
    at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
    at org.apache.axis.client.Call.invoke(Call.java:2467)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)

Is there a way to bypass this exception instead of using invokeOneWay function (which is not a good way I suppose)?

Upvotes: 1

Views: 4570

Answers (1)

dirgee
dirgee

Reputation: 21

Solved it by adding output messages to service.

<xsd:element name="Code" type="codeDT" />
<xsd:complexType name="codeDT">
    <xsd:sequence>
        <xsd:any />
    </xsd:sequence>
</xsd:complexType>
...
<wsdl:message name="Code">
    <wsdl:documentation />
    <wsdl:part name="Code" element="p1:Code" />
</wsdl:message>

Just changing return type AXIS_VOID to SOAP_ELEMENT inside stub works fine but oh well; this way I can get what's inside of value tag even though I don't need it.

Upvotes: 1

Related Questions