Nice work around...But could u please log a bug?
-- dims
On 11/11/05, Kyle M Himmerick <[EMAIL PROTECTED]> wrote:
>
>
> Just as a follow up I ended up writing a simple Handler to modify the
> outbound response message.
>
>
> import javax.xml.soap.SOAPBody;
>
> import org.apache.axis.AxisFault;
> import org.apache.axis.Message;
> import org.apache.axis.handlers.BasicHandler;
> import org.apache.axis.message.RPCElement;
>
> public class MyHandler extends BasicHandler {
> /* (non-Javadoc)
> * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
> */
> public void invoke(org.apache.axis.MessageContext msgContext) throws
> AxisFault {
> try{
> Message msg = msgContext.getResponseMessage();
> SOAPBody soapBody = msg.getSOAPBody();
> RPCElement root = (RPCElement) soapBody.getFirstChild();
> root.setName("RequestAcknowledgement");
> }catch (Exception e){
> e.printStackTrace();
> }
> }
> }
>
> This handler is invoked by having it in the responseFlow for the service
>
> <responseFlow>
> <handler type="java:package.MyHandler"/>
> </responseFlow>
>
> Regards,
> Kyle Himmerick
>
>
> Kyle M Himmerick/Boulder/[EMAIL PROTECTED]
>
>
>
>
>
>
>
> Kyle M Himmerick/Boulder/[EMAIL PROTECTED]
>
> 11/10/2005 11:28 AM
>
> Please respond to
> axis-user
>
>
> To
> [email protected]
>
>
> cc
>
>
>
> Subject
> Axis not conforming to WSDL response element definition
>
>
> 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
>
>
>
>
--
Davanum Srinivas : http://wso2.com/blogs/