I am creating a client in java using axis2 1.1.1 to test
interoperability with WCF web services. My WCF web service is based on
wsHttpBinding. When I am trying to call its methods I am getting this
axis fault error.

org.apache.axis2.AxisFault: The SOAP action specified on the message,
'', does not match the HTTP SOAP Action,
'http://tempuri.org/IMyService/MyOperation1'.

My wsdl is

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions name="MyService"
targetNamespace="http://tempuri.org/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:tns="http://tempuri.org/";
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing";
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract";
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl";
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
xmlns:wsa10="http://www.w3.org/2005/08/addressing";
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex";>
<wsp:Policy wsu:Id="WSHttpBinding_IMyService_policy">
<wsp:ExactlyOne>
<wsp:All>
 <wsaw:UsingAddressing />
 </wsp:All>
 </wsp:ExactlyOne>
 </wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports";>
 <xsd:import 
schemaLocation="http://svr11.lab.interface.local/WCFService/Service.svc?xsd=xsd0";
namespace="http://tempuri.org/"; />
 <xsd:import 
schemaLocation="http://svr11.lab.interface.local/WCFService/Service.svc?xsd=xsd1";
namespace="http://schemas.microsoft.com/2003/10/Serialization/"; />
 <xsd:import 
schemaLocation="http://svr11.lab.interface.local/WCFService/Service.svc?xsd=xsd2";
namespace="http://schemas.datacontract.org/2004/07/"; />
 </xsd:schema>
 </wsdl:types>
<wsdl:message name="IMyService_MyOperation1_InputMessage">
 <wsdl:part name="parameters" element="tns:MyOperation1" />
 </wsdl:message>
<wsdl:message name="IMyService_MyOperation1_OutputMessage">
 <wsdl:part name="parameters" element="tns:MyOperation1Response" />
 </wsdl:message>
<wsdl:message name="IMyService_MyOperation2_InputMessage">
 <wsdl:part name="parameters" element="tns:MyOperation2" />
 </wsdl:message>
<wsdl:message name="IMyService_MyOperation2_OutputMessage">
 <wsdl:part name="parameters" element="tns:MyOperation2Response" />
 </wsdl:message>
<wsdl:portType name="IMyService">
<wsdl:operation name="MyOperation1">
 <wsdl:input wsaw:Action="http://tempuri.org/IMyService/MyOperation1";
message="tns:IMyService_MyOperation1_InputMessage" />
 <wsdl:output wsaw:Action="http://tempuri.org/IMyService/MyOperation1Response";
message="tns:IMyService_MyOperation1_OutputMessage" />
 </wsdl:operation>
<wsdl:operation name="MyOperation2">
 <wsdl:input wsaw:Action="http://tempuri.org/IMyService/MyOperation2";
message="tns:IMyService_MyOperation2_InputMessage" />
 <wsdl:output wsaw:Action="http://tempuri.org/IMyService/MyOperation2Response";
message="tns:IMyService_MyOperation2_OutputMessage" />
 </wsdl:operation>
 </wsdl:portType>
<wsdl:binding name="WSHttpBinding_IMyService" type="tns:IMyService">
 <wsp:PolicyReference URI="#WSHttpBinding_IMyService_policy" />
 <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"; />
<wsdl:operation name="MyOperation1">
 <soap12:operation
soapAction="http://tempuri.org/IMyService/MyOperation1";
style="document" />
<wsdl:input>
 <soap12:body use="literal" />
 </wsdl:input>
<wsdl:output>
 <soap12:body use="literal" />
 </wsdl:output>
 </wsdl:operation>
<wsdl:operation name="MyOperation2">
 <soap12:operation
soapAction="http://tempuri.org/IMyService/MyOperation2";
style="document" />
<wsdl:input>
 <soap12:body use="literal" />
 </wsdl:input>
<wsdl:output>
 <soap12:body use="literal" />
 </wsdl:output>
 </wsdl:operation>
 </wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="WSHttpBinding_IMyService"
binding="tns:WSHttpBinding_IMyService">
 <soap12:address
location="http://svr11.lab.interface.local/WCFService/Service.svc"; />
<wsa10:EndpointReference>
 
<wsa10:Address>http://svr11.lab.interface.local/WCFService/Service.svc</wsa10:Address>
 </wsa10:EndpointReference>
 </wsdl:port>
 </wsdl:service>
 </wsdl:definitions>

and the java code of the stub generated by axis is

  public  void startMyOperation1(

                org.tempuri.MyServiceStub.MyOperation1 param4,

                 final org.tempuri.MyServiceCallbackHandler callback)

               throws java.rmi.RemoteException{

             org.apache.axis2.client.OperationClient _operationClient
= _serviceClient.createClient(_operations[0].getName());
            
_operationClient.getOptions().setAction("http://tempuri.org/IMyService/MyOperation1";);
    _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



             // create SOAP envelope with that payload
             org.apache.axiom.soap.SOAPEnvelope env=null;

                                   //Style is Doc.


                                                   env =
toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                   param4,

optimizeContent(new javax.xml.namespace.QName("",
                                                   "MyOperation1")));

       //adding SOAP headers
        _serviceClient.addHeadersToEnvelope(env);
       // create message context with that soap envelope
       org.apache.axis2.context.MessageContext _messageContext = new
org.apache.axis2.context.MessageContext() ;
       _messageContext.setEnvelope(env);

       // add the message contxt to the operation client
       _operationClient.addMessageContext(_messageContext);



                          _operationClient.setCallback(new
org.apache.axis2.client.async.Callback() {
                   public void onComplete(
                           org.apache.axis2.client.async.AsyncResult result) {
                       java.lang.Object object =
fromOM(result.getResponseEnvelope().getBody().getFirstElement(),

org.tempuri.MyServiceStub.MyOperation1Response.class,

getEnvelopeNamespaces(result.getResponseEnvelope())
                           );

callback.receiveResultMyOperation1((org.tempuri.MyServiceStub.MyOperation1Response)
object);
                   }

                   public void onError(java.lang.Exception e) {
                       callback.receiveErrorMyOperation1(e);
                   }
               });


         org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
       if ( _operations[0].getMessageReceiver()==null &&
_operationClient.getOptions().isUseSeparateListener()) {
          _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
         _operations[0].setMessageReceiver(
                   _callbackReceiver);
       }

          //execute the operation client
          _operationClient.execute(false);

                   }

clearly it is sending  SOAP Action which is matching with SOAP action
in the wsdl for the method.

Can any one help on this issue?

Thanks

Shantanu

--
Graduate Student
Department of Computer Science,
San Diego State University

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to