Skip to main content

Why does JAX-WS clients need WSDL access?

2 replies [Last post]
malm
Offline
Joined: 2006-05-29

The requirement that a JAX-WS based client needs access to the WSDL even if generated from a WSDL in the first place is a real pain. If wsimport can compile the WSDL into artifacts why does JAX-WS at runtime need to do it again?

In the cases I have to deal with the WSDL is not readily available, i.e. it is provided off-line, and I need to modify it any way because wsimport doesn't like it in its original form in the first place.

Now I somehow have to bundle it with my client apps, may be use catalogs to access it, etc.. If JAX-WS was suppose to make things easier it seems to fail badly here.

I am not aware that other toolchains require the WSDL to be available to the client at run-time if the client is based on generated artifcats.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jitu
Offline
Joined: 2003-06-14

The following thread has some discussion about this:
http://forums.java.net/jive/thread.jspa?forumID=46&threadID=1168&message...

LeslieM
Offline
Joined: 2011-09-15

The above link is no longer valid.

Try http://weblogs.java.net/blog/vivekp/archive/2007/06/portable_client.html

Also, the Glassfish 3.1 JAX-WS 2.2.2 implementation of wsimport allows for bundling the WSDL into the generated proxy - see

wsimport -clientjar option to ease the client-side web service 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."

I think it can be integrated into other platforms using the JDK 1.6. See http://weblogs.java.net/blog/vivekp/archive/2007/01/running_jaxws_2.html