Friday, January 8, 2010

JAX-WS Proxy client for a WSDL that container HTTP Binding rather than SOAP Binding

I came across a curios bug where the WSDL uses HTTP Binding rather than SOAP Binding. This caused all sort of hell with the proxy wizard in JDeveloper, which I am working on, but I still ran into problems when I tried to run the client that was generated from the wsimport tool.

It turns out that the JAX-WS dynamic proxy client, the ones with the SEI, doesn't support HTTP/REST out of the box. In order to have this working you need to add both a binding feature and to set the endpoint address. So you code looks something like this:

    Port port = service.getMyPort(
        new BindingTypeFeature(JAWWSProperties.REST_BINDING));

Not something you will come across every day; but worth knowing all the same.

1 comment:

Vardhan said...

Thanks Gerard for all the fantastic posts. I was searching for an blog/article on creating a WS client using WSDL and deploy it using jdev 11g R1. Can you please give me some pointer. Thanks so much in advance.