Java – Consuming a WCF WsHttpBinding WebService in Java

javawcfwcf-bindingweb serviceswshttpbinding

I'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService. But I am unable to do so. The call either hangs, or I get "musunderstoodheader expcetions".

My Web Service is just the default Visual Studio generated "WCF Service Library Template".

My Web Service Client is just a blank IntelliJ project, with the corresponding stub generated using "Add Web Service Client" (the webservice platform specified is JAX-WS 2.X).

When I change my binding to BasicHttpBinding everything works flawlessly.

I've tried playing with the WsHttpBinding configuration, including turning off security, but I've had no success.

Suggestions ? Thoughts ? Is the WsHttpBinding only partially supported by JAX-WS 2.0?

Best Answer

Your problem is that JAX-WS doesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSIT instead. WSIT is available as part of the Metro library, which is also available on Glassfish.

I recommend using wsHttpBinding or ws2007HttpBinding where possible, but you can still do a fairly secure service with basicHttpBinding over SSL/Transport Auth.