Search code examples
cachingjax-ws

How to cache JAX-WS stub/port in Java?


The use case is that the application (running on JBoss 5) must operate on very limited bandwidth. Currently every time we go to make a webservice call we request the wsdl and recreate the stub using JAX-WS. Each time the stub is created the wsdl and schema is redownloaded. Idealy the wsdl would never be downloaded since we already have a copy of the schema, but even caching would work. Bonus points if the cache is Serializable!

Is it possible to cache a JAX-WS stub/port?


Solution

  • Best answer found so far:

    Tell the service to look at a local wsdl: JAX-WS client : what's the correct path to access the local WSDL?

    Change the endpoint on the fly: JAX-WS Loading WSDL from jar


    I don't see a way to cache, but using a local copy can be done as specified on this page on metro: Developing client application with locally packaged WSDL

    (found on SO question : How to cache a WSDL with Java-WS)