To my knowledge, there isn't a way in the specification - which means you may have to use a proprietary mechanism in your JAX-WS runtime provider.
For example, if your JAX-WS client application is running in IBM's WebSphere Application Server, you can set the https.proxyHost
and https.proxyPort
properties on the RequestContext
of the BindingProvider
(your client):
//Set the https.proxyHost as a property on the RequestContext.
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put("https.proxyHost", "proxyHost1.ibm.com");
bp.getRequestContext().put("https.proxyPort", "80");
If you're using Metro, the JAX-WS reference implementation, the documentation says it utilizes the JDK's HttpsURLConnection to make the client HTTPS request, but offers this tip for providing your own SSLSocketFactory by setting a custom property on the RequestContext
of the BindingProvider
:
SSLSocketFactory sslSocketFactory = ...; //your implementation that uses a proxy
Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
ctxt.put(JAXWSProperties.SSL_SOCKET_FACTORY, sslSocketFactory);
If you don't want to use the JAXWSProperties constant for the key, you can use its string value:
ctxt.put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
sslSocketFactory);