JAX-WS client authentication on a proxy server

I am trying to use the JAX-WS api to send some soap messages to a client application. However, I am behind the firewall, and the only option is to use a proxy server to go outside.

I'm trying to find any answer to Google about this, and so far everything is not possible: Use System.setPropertyto http.proxyHost, http.proxyPort, http.proxyUser, http.proxyPassword. Use Authenticator as described here .

I'm running out of options, if someone can help me with this, it would be great.

In addition, I have the ability to use org.apache.commons.httpclient, but then I need to manually create XML. Can you suggest any other approach or API for WS?

+3
source share
2 answers

You can use the ws import command when creating the web client to configure the proxy.

-httpproxy ::

use the command above to configure the proxy.

How to do this depends on your development environment.

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wsfep.multiplatform.doc/info/ae/ae/rwbs_wsimport.html

0
source

For the Jax-ws webservice client, use the following

//set proxy info to the ClientProxyFeature
ClientProxyFeature cpf = new ClientProxyFeature();
cpf.setProxyHost("proxyhost");
cpf.setProxyPort(8888);
cpf.setProxyUserName("proxyuser");
cpf.setProxyPassword("proxypwd");

//get the port with the Feature
MyPort port = myService.getPort(cpf);
0
source

Source: https://habr.com/ru/post/1758161/


All Articles