Hello,
I am trying to get Axis to conform to a WSDL definition that specifies a response element for each operation. From my PD it looks like RPCProvider is only using the requested method name and appending a hard coded string of 'Response'. This is unacceptable in our current environment and I need access to return a different root element.
Here is an extract from the WSDL
<types>
<xsd:schema>
<xsd:element name="TicketCreateAsync">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="ms:TicketCreate"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="TicketCreateAsyncResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="ms:TicketCreateResponse"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RequestAcknowledgement">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="mh:Acknowledgement"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="TicketCreateAsyncMsg">
<part name="in" element="tns:TicketCreateAsync"/>
</message>
<message name="TicketCreateAsyncResponseMsg">
<part name="in" element="tns:TicketCreateAsyncResponse"/>
</message>
<message name="RequestAcknowledgementMsg">
<part name="out" element="tns:RequestAcknowledgement"/>
</message>
<portType name="MaintenanceServicesAsyncPortType">
<operation name="TicketCreateAsync">
<input name="TicketCreateAsyncIn" message="tns:TicketCreateAsyncMsg"/>
<output name="TicketCreateAsyncOut" message="tns:RequestAcknowledgementMsg"/>
<fault name="WSException" message="tns:WSException"/>
</operation>
....
</portType>
<binding name="MaintenanceServicesAsyncBinding" type="tns:MaintenanceServicesAsyncPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="TicketCreateAsync">
<soap:operation style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="WSException">
<soap:fault name="WSException" use="literal"/>
</fault>
</operation>
....
</binding>
Here is an extract from org.apache.axis.providers.java.RPCProvider where I'm seeing the hard coded + "Response"
protected RPCElement createResponseBody(RPCElement body, MessageContext msgContext, OperationDesc operation, ServiceDesc serviceDesc, Object objRes, SOAPEnvelope resEnv, ArrayList outs) throws Exception
{
String methodName = body.getMethodName();
/* Now put the result in the result SOAPEnvelope */
RPCElement resBody = new RPCElement(methodName + "Response");
resBody.setPrefix(body.getPrefix());
resBody.setNamespaceURI(body.getNamespaceURI());
resBody.setEncodingStyle(msgContext.getEncodingStyle());
So per my wsdl my response should look like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://x.com/schema/MsgHeader/v1_0" xmlns:m1="http://x.com/schema/MaintenanceServices/v4_0">
<SOAP-ENV:Body>
<m:RequestAcknowledgement xmlns:m="http://x.com/wsdl/MaintenanceServices/v2_0">
<m0:MessageHeader xmlns:m0="http://x.com/schema/MsgHeader/v1_0">
...
</m0:MessageHeader>
<m0:Acknowledgement>
<m0:ResponseGuidanceNumber>10</m0:ResponseGuidanceNumber>
</m0:Acknowledgement>
</m:RequestAcknowledgement>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
But instead is like this:
<?xml version="1.0" encoding="utf-8"?>
<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>
<TicketCreateAsyncResponse xmlns="http://x.com/wsdl/MaintenanceServices/v2_0">
<ns2:MessageHeader xmlns:ns2="http://x.com/schema/MsgHeader/v1_0">
...
</ns2:MessageHeader>
<ns1:Acknowledgement xmlns:ns1="http://x.com/schema/MsgHeader/v1_0">
<ns1:ResponseGuidanceNumber>10</ns1:ResponseGuidanceNumber>
</ns1:Acknowledgement>
</TicketCreateAsyncResponse>
</soapenv:Body>
</soapenv:Envelope>
Again the difference I am focused on and need to correct is the top element within the SOAENV:Body, this element should be RequestAcknowledgement instead of TicketCreateAsyncResponse. The TicketCreateAsyncResponse message is actually another message type we are passing (an asynchronous response).
I generated Client and Server stubs using WSDL2Java with the following parms:
WSDL2Java -w --server-side --skeletonDeploy true MaintenanceServicesASync.wsdl
Is there a workaround to have the correct response returned? I'm thinking I either need a custom provider that is capable of setting the response element or a handler to modify the response.
What am I missing? or any suggestions?
Thanks,
Kyle Himmerick
- Axis not conforming to WSDL response element definition Kyle M Himmerick
- Re: Axis not conforming to WSDL response element def... Kyle M Himmerick
- Re: Axis not conforming to WSDL response element... Davanum Srinivas
