简体   繁体   中英

How to tell wsimport to use an httpproxy into generated classes

With wsimport command included in JDK6 it is possible to generate the Java classes needed to invoke a Web Service, starting from it's WSDL.

Once these classes are generated however, they may be used from within a network with an Http-Proxy .

The optimal solution for this should be to leverage the URL.openConnection(Proxy proxy) API instead of other system-wide (via system properties or with a ProxySelector) methods.

Is it possible to tell the wsimport command to use a given http-proxy into the generated code?

Please note that among the wsimport option there is also -httpproxy:<host>:<port> , but this is used only for allowing the generation behind an Http Proxy and the option has no effect on generated code. Further, looking at the generated classes there is not even an explicit call to URL.openConnection(), so apparently there is no way to override this behaviour.

I think that there is no way to actually generate stubs with the proxy they are going to be used with. In fact why they should be? Stubs are just stubs, a representation derived from wsdl. Why should they know about proxy? If the same application is moved to other system with different proxy, then code needs to be changed ie stubs needs to be generated again with the knowledge of new proxy. This is clearly undesirable. So in my knowledge I don't think that's even a possibility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM