Skip to main content

wsimport -clientjar option to ease the client-side web service programming

Posted by ramapulavarthi on September 3, 2010 at 2:18 PM PDT

 One of the features introduced in JAX-WS 2.2.2 RI, integrated in Glassfish 3.1 MS4, is the clientjar option to ease client-side web services programming. 

As you know, the standard client-side programming with JAX-WS RI involves running wsimport on the service wsdl, which generates the necessary classes needed for web service invocation. But all the information required by the JAX-WS runtime is not captured in the SEI or the WebServiceClient through standard web service annotations defined in the JAX-WS/JSR-181 spec. JAX-WS RI also saves the location of the wsdl in the generated classes so that it can retrieve the additional metadata of the service. This ability to fetch metadata at runtime is useful when there are some changes in endpoint policy or some compatible changes made in the service definition, the clients need not have to be regenerated. But, this  requires an additional connection just to access the metadata each time a service instance is created which can be costly at times. To workaround this, One could download the wsdl and make it accessible to the client runtime via jax-ws-catalog or other means. But, its painful to download all the wsdls and schema associated with the service and generate  jax-ws catalog to use the local files. 

In JAX-WS 2.2.2 RI, we are introducing -clientjar option for wsimport, which automatically downloads the wsdl and schema and packages all the generated client-side artifacts into a jar file. Just invoke wsimport as follows "wsimport -clientjar wsclient.jar http://example.com/service/hello?WSDL". So, invoking the web service from your program is as easy as placing the generated client jar in the classpath. A sample "wsimport_clientjar" is bundled in JAX-WS RI/ Metro 2.0 nightly bundles. Give it a try.

Comments

You have really taken

You have really taken something that at first seems really difficult and shown us how to quickly and easily obtain it. Thank you for taking the time to figure it out and for posting it.

  1. casino online: Non importa quale casino online io usi: tornerò sempre a giocare in questo casinò perché è un posto di cui fidarsi.