The WSDL and client code generate开发者_高级运维d using wsimport are very big. So want a way / setting in jaxws to load only necessary client classes instead of loading all of them which takes ~10 secs and heap consumed is also huge. Also on creating multiple ports using different 10 threads the memory used is easily going up to 1.5G and getting out of memory error.
It will be of great help if I can get to load the client stub objects lazily.
Your problem cannot be fixed the way you expect. Java loads classes in a lazy manner anyway, it doesn't act differently with JAX-WS and it's not acting strangely in your specific case. There's no setting in JAX-WS to change something and solve your problem.
It seems to me that your real problem is a HUGE web service with myriads of methods, parameters, faults, etc, although I tend to believe your heap usage and out-of-memory conditions should be attributed to the rest of the application and not to the JAX-WS client.
I think your solution is in the direction of breaking-up your one, huge web service into multiple web services, partitioned by functionality or some other concept. Then, you would only be using the services (and their clients) that you really need.
精彩评论