views:

36

answers:

1

We have a .NET 2.0 web service (.ASMX file). This web service is being called by a Java client and they are not passing in a SoapAction header.

This causes our web service to fail with the error: : "Server did not recognize the value of HTTP Header SOAPAction: ."

There is no chance that I can convince the development team in charge of the calling Java client to include a SoapAction header.

Is there anyway to resolve this problem on my end?

Can I prevent .NET from throwing this error when the SoapAction is missing? Can I direct the call to the correct WebMethod programmatically?

Something like this psuedo-code,

if (Header.SoapAction == String.Empty) then MyWebMethod();
A: 

According to the SOAP 1.1 specification this is required of HTTP clients.

6.1 SOAP HTTP Request

Although SOAP might be used in combination with a variety of HTTP request methods, this binding only defines SOAP within HTTP POST requests (see section 7 for how to use SOAP for RPC and section 6.3 for how to use the HTTP Extension Framework).

6.1.1 The SOAPAction HTTP Header Field

The SOAPAction HTTP request header field can be used to indicate the intent of the SOAP HTTP request. The value is a URI identifying the intent. SOAP places no restrictions on the format or specificity of the URI or that it is resolvable. An HTTP client MUST use this header field when issuing a SOAP HTTP Request.

Source http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528

From a quick Google it seems this is a common issue with Java and Axis, but there is some debate whether it is required. Could this help you convince the Java developers that they need to implement the header?

Edit:

The correct URI for your SoapAction http header is defined in the WSDL document.

Goto http://mydomain.com/myservice.asmx?wsdl

Look for the wsdl:operation element for the method you are calling, it should have a child element soap:operation which has a attribute called soapaction, the URI in there is the one you should use. In a webservice i tested it looks like the namespace followed by / and the method name as follows.

<wsdl:operation name="AddTwoNumbers">
  <soap:operation soapAction="http://mydomain.com/myservice/AddTwoNumbers" style="document"/>
Chris Diver
Thanks for the help, Chris. That same document says, "The header field value of empty string ("") means that the intent of the SOAP message is provided by the HTTP Request-URI." The header they send does have a SoapAction field but it is set to an empty string (""). So maybe I have just given them the wrong HTTP Request-URI? Right now they are going to http://mydomain.com/myservice.asmx. What would the correct HTTP Request-URI be for a WebMethod called MyWebMethod?
DarenTx
I've edited the post for you. in your case the HTTP request URI points to the ASMX file and not the method so I assume you cannot leave it as an empty string.
Chris Diver