You don’t need another WCF client to test WCF services if you already have fantastic Postman installed on your machine. But requesting WCF service using Postman needs little more than just providing a Service Url and a Xml body to the SOAP request. One issue developers always stumble upon first time when using Postman to call a Wcf service is this cryptic error message:
The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher..
Following is an example ActionNotSupported fault response raised by the Wcf Service:
Inspecting the exception fault string more carefully, you will surely realize that the exception has something to do with Action “. Postman is apparently not sending any Action contract with the SOAP request, and Wcf service is treating it as empty Action. With the empty received Action, service trying to match it with its own Action contract which result as mismatch. And this is what is causing the exception.
To resolve the issue, you need to explicitly provide a SOAPAction to the header with your SOAP request to the service. You can get the SOAPAction of the web method from the WSDL document of your Wcf service. Just navigate to the WSDL Uri, which usually your Wcf service Url appended with “?wsdl”, and look for soap:operation node of the web method you want to call. Copy the value of soapAction attribute which will be something like
http://tempuri.org/I<Your Service Name>/<Method Name> and use this value as SOAPAction of your service call.
Adding SOAPAction header in Postman is simple. You have to goto Headers tab of the Postman for the Wcf service, add a New key, provide Key as “SOAPAction” and the Value whatever you copied in above step.
With the SOAPAction configured for your Wcf service, hit Send button in Postman to make service call and voila! You should receive proper SOAP response from the service. Save the Service request in the Postman so that you don’t have to do the same SOAPAction configuration again for the service.
My automatized workflow to setup Postman to call Wcf service is following:
- Make GET call of the service Url with appended “?wsdl”.
- Copy the value of soapAction attribute of your SOAP method.
- Change Http method to POST and remove “?wsdl”
- Provide header with key “SOAPAction” and value copied soapAction attribute.
- Set “Content-Type” header as “text/xml”
- Provide SOAP Envelop in Body
- Hit Send (and Save for the future task).