axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyle M Himmerick <>
Subject Re: Axis not conforming to WSDL response element definition
Date Fri, 11 Nov 2005 15:03:14 GMT

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
      public void invoke(org.apache.axis.MessageContext msgContext) throws
AxisFault {
                  Message msg = msgContext.getResponseMessage();
                  SOAPBody soapBody = msg.getSOAPBody();
                  RPCElement root = (RPCElement) soapBody.getFirstChild();
            }catch (Exception e){

This handler is invoked by having it in the responseFlow for the service

      <handler type="java:package.MyHandler"/>

Kyle Himmerick

             Kyle M                                                        
             /IBM@IBMUS                                                 To 
             11/10/2005 11:28                                           cc 
                                       Axis not conforming to WSDL         
             Please respond to         response element definition         


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

<xsd:element name="TicketCreateAsync">
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="ms:TicketCreate"/>
<xsd:element name="TicketCreateAsyncResponse">
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="ms:TicketCreateResponse"/>
<xsd:element name="RequestAcknowledgement">
<xsd:element ref="mh:MessageHeader"/>
<xsd:element ref="mh:Acknowledgement"/>
<message name="TicketCreateAsyncMsg">
<part name="in" element="tns:TicketCreateAsync"/>
<message name="TicketCreateAsyncResponseMsg">
<part name="in" element="tns:TicketCreateAsyncResponse"/>
<message name="RequestAcknowledgementMsg">
<part name="out" element="tns:RequestAcknowledgement"/>

<portType name="MaintenanceServicesAsyncPortType">
<operation name="TicketCreateAsync">
<input name="TicketCreateAsyncIn" message="tns:TicketCreateAsyncMsg"/>
<output name="TicketCreateAsyncOut"
<fault name="WSException" message="tns:WSException"/>

<binding name="MaintenanceServicesAsyncBinding"
<soap:binding style="document" transport=""/>
<operation name="TicketCreateAsync">
<soap:operation style="document"/>
<soap:body use="literal"/>
<soap:body use="literal"/>
<fault name="WSException">
<soap:fault name="WSException" use="literal"/>

Here is an extract from 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");

So per my wsdl my response should look like:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:SOAP-ENC="" xmlns:xsi="" xmlns:xsd="" xmlns:m0="" xmlns:m1="">
<m:RequestAcknowledgement xmlns:m="">
<m0:MessageHeader xmlns:m0="">

But instead is like this:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv=""
xmlns:xsd="" xmlns:xsi="">
<TicketCreateAsyncResponse xmlns="">
<ns2:MessageHeader xmlns:ns2="">
<ns1:Acknowledgement xmlns:ns1="">

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
WSDL2Java -w --server-side --skeletonDeploy true

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?

Kyle Himmerick
View raw message