I was tasked with making a java client utilize a WCF service.
The details:
- JDK/JRE 1.6
- NetBeans 6/JAXWS
- .NET 3.0
- WCF
It is obvious per the title of this post that the communication did not work out of the box. There was nothing special I did on Java’s side. Rather I became more familiar with the default behavior of WCF. Such as the default message version (SOAP version) for WCF, this is defined as WS-Addressing 1.0 and SOAP 1.2. Now, the default for JAXWS is SOAP 1.1. So right there you see where a problem can arise between these two technologies.
My resolution was to edit the WCF host configuration to provide SOAP 1.0 support like so:
<bindings>
<customBinding>
<binding name="Soap11Binding">
<textMessageEncoding messageVersion="Soap11" />
<httpTransport />
</binding>
</customBinding>
</bindings>
Now what I have done with the above configuration is create a custom binding to support clients that are not currently able to (or refuse to) take advantage of SOAP 1.2 and WS-Addressing 1.0.
<endpoint
address="http://localhost/MyHost/MyService.svc"
binding="customBinding"
bindingConfiguration="Soap11Binding"
contract="Services.IMyService" />
This is how to utilize the custom binding you have created in your endpoint configuration.
After much staring out the window, this is the solution I found to make it work. Notice I did not say I found “the answer”. I am sure there is another solution out there, but this one worked best for what I was trying to accomplish. In fact, through my research I noticed that others were attempting to solve this from the Java side by exploring wsgen.exe (i.e. wsgen.exe –extension –wsdl:Xsoap1.2). I hope others find this post useful. I did a bit of searching about this topic and did not find enough information in my opinion (I admit my googling is sub-par). I found a lot of talk and not much doing.
Is there anyone out there having to communicate with WCF with a non-.NET client? What difficulties have you discovered in doing so?