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

A use case is that an application (running on JBoss 5) should run at very limited bandwidth. Currently, every time we go to a webservice call, we request wsdl and recreate the stub using JAX-WS . Each time a stub is created, wsdl and the circuit reboot. Idealy wsdl will never load, since we already have a copy of the circuit, but even caching will work. Reward Points if the cache is Serializable!

Can I cache the JAX-WS stub / port?

+4
source share
2 answers

The best answer so far found:

Tell the service to look at the local wsdl: JAX-WS client: what is the right way to access the local WSDL?

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


I don’t see a way to cache, but using a local copy can be done as indicated on this page in the metro: Developing a client application with local batch WSDL

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

+3
source

I think we can cache the stub using org.apache.commons.pool2.impl.GenericObject lirbrary.

See link below for this.

https://github.com/vikashnitk50/fasypay-webservice-client/tree/master/fasypay-webservice-client/src/main/java/com/fastpay/webservice/client

+1
source

All Articles