none
ActionMismatchAddressingException RRS feed

  • Question

  • Hello,

    I've setup a WCF Host, running as a Windows Service, to expose a web service on port 8080.  I then created a simple VB.NET Windows Forms application and added the a web reference to the above web service.

    When I attempt to invoke the only method on the web service, I get the following exception:

    System.ServiceModel.ActionMismatchAddressingException,

    The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IFilteredService/GetCustomerFinancials'.

    I've "googled" the exception and got 0 hits (kind of surprising).

    Does anyone know what causes this?

     

     

    Tuesday, January 23, 2007 3:51 PM

Answers

  • When you do SOAP over HTTP on a binding that uses WS-Addressing, there are two places an Action header goes.  First, there is a SoapAction header on the Http POST request itself, and second, there is a <wsa:Action> header in the SOAP message (the XML payload body of the POST).  In this case, it sounds like your VB client is setting the Http SoapAction header, but not putting the proper wsa:Action header into the SOAP message.

    http://www.w3.org/TR/ws-addr-soap/#id2270759

    What binding is the server using?  Based on the exception, it sounds like it's probably using a Binding that uses WS-Addressing (like WsHttpBinding).  But if you're using 'add web reference' in VS, you'd be generating a .NET 2.0 proxy, which doesn't speak the newer WS protocols like WS-Addressing.  You could either change the server to use the backward-compatible BasicHttpBinding, or use 'add service reference' in VS to generate a WCF client proxy that can talk to the service.  I'm pretty sure one of these options should solve the problem, but if not, post again and include the details of the binding used on the server.

    Wednesday, January 24, 2007 6:40 AM

All replies

  • Hi,

      Have you checked if your proxy's action matches with your service call?

    Thanks,

    Daniel

    Tuesday, January 23, 2007 6:19 PM
    Moderator
  • When you do SOAP over HTTP on a binding that uses WS-Addressing, there are two places an Action header goes.  First, there is a SoapAction header on the Http POST request itself, and second, there is a <wsa:Action> header in the SOAP message (the XML payload body of the POST).  In this case, it sounds like your VB client is setting the Http SoapAction header, but not putting the proper wsa:Action header into the SOAP message.

    http://www.w3.org/TR/ws-addr-soap/#id2270759

    What binding is the server using?  Based on the exception, it sounds like it's probably using a Binding that uses WS-Addressing (like WsHttpBinding).  But if you're using 'add web reference' in VS, you'd be generating a .NET 2.0 proxy, which doesn't speak the newer WS protocols like WS-Addressing.  You could either change the server to use the backward-compatible BasicHttpBinding, or use 'add service reference' in VS to generate a WCF client proxy that can talk to the service.  I'm pretty sure one of these options should solve the problem, but if not, post again and include the details of the binding used on the server.

    Wednesday, January 24, 2007 6:40 AM
  • Brian,

    That was exactly the issue - I was using "wsHttpBinding" so I changed it to "basicHttpBinding" and all seems well.  Thanks for the reply.

    Wednesday, January 24, 2007 1:36 PM
  • Hello Brian,
            I basically can get "BasicHttpBinding" work also. but find difficulty to get WsHttpBinding work with NetBeans 6.1 client. I get same error as above but don't know how to put <wsa:Action> tag to Header.

    NetBeans 6.1 Wsdl Client

    try { // Call Web Service Operation
    org.tempuri.Service1 service = new org.tempuri.Service1();
    org.tempuri.IService1 port = service.getWSHttpBindingIService1();
    // TODO initialize WS operation arguments here
    java.lang.Integer value = Integer.valueOf(0);
    // TODO process result here
    java.lang.String result = port.getData(value);
    System.out.println("Result = " + result);
    } catch (Exception ex) {
    // TODO handle custom exceptions here
    System.out.println("Error = " + ex.getMessage());
    }



    I assume that the request header should look like this..

    <s:Header>
    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action>
    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost/STS/STSService.svc/mex</wsa:To>
    <wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:778b135f-3fdf-44b2-b53e-ebaab7441e40</wsa:MessageID>
    </s:Header>

    any help would very appreciate,
    -Jirapong
    Tuesday, August 5, 2008 8:28 AM
  • that is basically what the request header should look like, yes. Unfortunately I am not familiar with NetBeans, so I can't say how exactly you can set those headers.

    Ntl since I ran into exactly the same exception that triggered this thread, here are some other research results noteworthy while playing with BasicHttpBinding, WsHttpBinding and a java client:

    - The exception "...the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.." is caused because SOAP 1.1 requires text/xml and SOAP 1.2 requires application/soap+xml

    - The exception "The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IFilteredService/GetCustomerFinancials'. " is caused by a mismatch between the HTTP SOAP Action Header value and the value specified in the <wsa:Action> element.

    This may have several root causes:

    1)
    WsHttpBinding by default expects SOAP 1.2 and WS-Addressing 1.0 ("http://www.w3.org/2005/08/addressing " ) . In SOAP 1.2 the content type is expected to be application/soap-xml and the HTTP SOAP action header value is specified on the Content-Type header as shown in the sample snippet here:

    POST /MBeanServer HTTP/1.1
    Content-type: application/soap+xml;charset="utf-8";action="http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"

    <s:Header>
      <wsa :Action xmlns:wsa =" http://www.w3.org/2005/08/addressing "> http://schemas.xmlsoap.org/ws/2004/09/transfer/Get </wsa :Action >
    ...
    </s:Header>

    2)
    BasicHttpBinding uses SOAP 1.1 and a previous WS-Addressing Draft ("http://schemas.xmlsoap.org/ws/2004/08/addressing"). In SOAP 1.1 the content type is expected to be text/xml and the SOAP Action is specified as "SOAPAction" custom HTTP header

    POST /MBeanServer HTTP/1.1
    Content-type: text/xml;charset="utf-8"
    SOAPAction:"http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"

    <s:Header>
      <wsa :Action xmlns:wsa =" http://schemas.xmlsoap.org/ws/2004/08/addressing "> http://schemas.xmlsoap.org/ws/2004/09/transfer/Get </wsa :Action >
    ...
    </s:Header>


    The WCF binding implementations are pretty strict in this regard and you get the above exception if the client sends a SOAP 1.2 request, but uses the 2004/08 WS-Addressing scheme.

    I didn't find a good way yet to make WCF a bit more flexible. For now, to continue my work (on getting JConsole + JSR262 JMX Connector talk to a .NET server), I found this way to implement a WsHttpBinding that uses 2004/08 WS-Addressing:

    class Soap12Addressing200408WSHttpBinding : WSHttpBinding
    {
       public Soap12Addressing200408WSHttpBinding(SecurityMode securityMode) : base(securityMode)
       {}

       public override BindingElementCollection CreateBindingElements()
       {
           BindingElementCollection elements = base.CreateBindingElements();
           TextMessageEncodingBindingElement txtenc = elements.Find<TextMessageEncodingBindingElement>();
           txtenc.MessageVersion = MessageVersion.Soap12WSAddressingAugust2004;
           return elements;
       }
    }

    One of the situations where I hate MSFT to not being able to properly publish the framework sources... (yes, I know about Referencesource, no, they don't work for me...) If anyone knows a better way to let a binding handle both addressing schemes, please let me know!

    hth,
    Erich
    Monday, September 28, 2009 4:07 PM