You can configure a Web services client to access resources through a Web proxy server.
If you want to programmatically configure the HTTP properties using the Java API XML-based Remote Procedure Call (JAX-RPC) programming model, review the JAX-RPC specification that is available through Web services: Resources for learning.
For Java API XML-based Remote Procedure Call (JAX-RPC) Web services, the HTTP transport values take the following precedence order with the programmatic method being the most significant:You have configured your Web services client to use a Web proxy server to access resources.
You can optionally set the http.nonProxyHosts property to specify the host names of machines to which requests will not be sent through the proxy server. Any requests invoked by the client application that are sent to a host whose name is contained in this property will not pass through the proxy server. This property applies for both HTTP and HTTPS connections. To learn more about the http.nonProxyHosts property and other HTTP properties that you can configure, read about HTTP transport custom properties for Web services applications.
Configuring the HTTP proxy programmatically
import com.ibm.wsspi.webservices.Constants Properties prop = new Properties(); InitialContext ctx = new InitialContext(prop); Service service = (Service)ctx.lookup("java:comp/env/service/StockQuoteService"); QName portQname = new QName("http://httpchannel.test.wsfvt.ws.ibm.com", "StockQuoteHttp"); StockQuote sq = (StockQuote)service.getPort(portQname, StockQuote.class); ((javax.xml.rpc.Stub) sq)._setProperty(Constants.HTTP_PROXYHOST_PROPERTY, "proxyHost1.ibm.com"); ((javax.xml.rpc.Stub) sq)._setProperty(Constants.HTTP_PROXYPORT_PROPERTY, "80");
//Set the https.proxyHost as a property on the RequestContext. BindingProvider bp = (Binding Provider)port; bp.getRequestContext().put("https.proxyHost", "proxyHost1.ibm.com"); bp.getRequestContext().put("https.proxyPort", "80");
In this information ...Related tasks
Related reference
Related information
| IBM Redbooks, demos, education, and more(Index) |