Thursday, January 8, 2009

.NET Web Service Error: "Server did not recognize the value of HTTP Header SOAPAction"

Most of the time when we create a web service, we get to dictate what the final WSDL will look like and we use that in our application or provide it to other members on a team to consume.

A current project I'm working on requires me to create a web service based on an established WSDL that would be consumed by another service. In order for there to be interoperability between the 2, my WSDL and the reference WSDL had to be identical.

I went about creating the proxy class using WSDL.exe as I normally would and had my simple service up and running in about 5 minutes. When the external service tried to connect to mine, there was the "Server did not recognize the value of HTTP Header SOAPAction" error.

Upon closer examination, my WSDL was identical to theirs with one exception:

<soap:operation soapAction="FaultyAction" style="document" />

Should have been:

<soap:operation soapAction="" style="document" />

After some web-scouring, I finally determined how to set the soapAction attribute in the WSDL:

[WebMethod]
[SoapDocumentMethod(Action="")]
public Gateway_Response Gateway_Request(Gateway_Request returnValue)
{
...
}

No comments: