Invoking web services via proxy using JAX-RPC and JAX-WS
Invoking Web Services through a proxy using JAX-WS MyService service = null; service = new MyService(); MyServiceSoap port = service.getMyServiceSoap(); BindingProvider bp = (BindingProvider) port; Binding binding = bp.getBinding(); Map ctx = bp.getRequestContext(); ctx.put(BindingProvider.USERNAME_PROPERTY, "proxyuser"); ctx.put(BindingProvider.PASSWORD_PROPERTY, "proxypassword"); Note that we don't specify the Proxy Server here. JAX-WS sends authentication information for the proxy in request headers. Invoking Web Services through a proxy using JAX-WS private HttpTransportInfo getHttpInfo() { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyServer", 9090)); HttpTransportInfo httpInfo = new HttpTransportInfo(); httpInfo.setProxy(proxy); httpInfo.setProxyUsername("proxyuser".getBytes()); httpInfo.setProxyPassword("proxypassword".getBytes()); ret...