Connection reset from a WCF Web Service

Here is an error message you may see, when calling WCF Web Services from java:
IOException retrieving the response: Connection reset

As it may not be obvious the first time you see it, this may save you some time.

One reason for this behaviour is when the WCF endpint is expecting to see wsa:Action SOAP header in the request.

To find out if you are facing this case, you have to look inside the WSDL, and search for the policy that describes the contract for your endpoint.

<wsp:Policy wsu:Id="CustomBinding_Echo1_policy">

To make this a concrete example, here is a sample WSDL. To find the policy, you will need to follow the import as the policy are not always advertized in the top-level document.

Here is how the import looks:

  <wsdl:import namespace="" location="http://.../WSAddressing10.svc?wsdl=wsdl1"/>

To get around this, make sure you have the proper wsa:Action value in the reques, as in this sample:

<env:Header xmlns:wsa="">

Another thing to watch for is the value used for the SOAP Action (SOAP 1.1) or the action attribute in the Content-type (for SOAP 1.2).

Here is a SOAP 1.2 sample:
Content-type: application/soap+xml; charset=UTF-8;

Remember that the two value must be identical, for the messages to be processed by WCF. Otherwise, you will get a "connection reset" error message at best, or see the connection left open indefinitely.

Happy SOA coding



James P said…
Yep, I ran into this problem in both Axis2 and Metro. It took me a day to figure it out. Thanks for posting!

Popular posts from this blog

Changing the version of JDK used by JDeveloper

Why ws-rx ?