Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF web service without SOAPAction header

How can I implement a web service in WCF such that it does not require the SOAPAction header to be present in the request, and would thus dispatch the call using the message body root element name? By default, BasicHttpBinding requires the SOAPAction.

I need this to provide compatibility with a client that does not use SOAPActions. This is my SOAP message:

<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<messageDeliveryReport xmlns="http://bogus/ns"><status>D</status><systemName>cc</systemName></messageDeliveryReport>
</env:Body></env:Envelope>

and I want it to call 'messageDeliveryReport' operation. Thanks!

like image 501
nightwatch Avatar asked Nov 02 '11 13:11

nightwatch


1 Answers

It's not an issue of BasicHttpBinding, it's an issue of adhering to the SOAP 1.1 standard which says:

An HTTP client MUST use this header field when issuing a SOAP HTTP Request.

So what you're dealing with is a client that doesn't conform to a standard that's existed since 2000. You might be able to work around this problem by implementing one of the extensibility points of WCF which are explained in greater detail in the MSDN article Extending WCF with Custom Behaviors, probably either IDispatchMessageInspector or IDispatchOperationSelector, but the request may not even make it that far since the message really isn't a valid SOAP request to begin with.

like image 113
Joel C Avatar answered Sep 18 '22 06:09

Joel C