Thursday, November 4, 2010

On SOAP Action in WCF router (3.x)

In case you set arbitrary SOAP Action via HttpRequestMessageProperty before sending to WCF Router, you might be getting:

“The SOAP action specified on the message, '"/xyz"', does not match the action specified on the HttpRequestMessageProperty, '/xyz'.” in the System.ServiceModel.dll!System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.PrepareHttpSend(System.ServiceModel?.Channels.Message message)

Given the hurdles with wcf step into the source thing, Reflector gives a good peek into the incriminated method:

Not sure what the “smart” feature is of putting action into quotes in the beginning, as it is never going to work in the described scenario. But at least fix is obvious here, nullify the action before resending, so it is picked up from the HttpRequestMessageProperty again.