I know this isn't exactly the correct way to ask a question, but I'm having a problem:
I have a wsdl stored locally, and I need to create a Web Service Client to call that Web Service. The problem is the service is behind a firewall and I have to connect to it through a proxy and after that I have to authentify to connect to the WS.
What i did is generate the WS Client with Apache CXF 2.4.6 then set a system wide proxy
System.getProperties().put("proxySet", "true");
System.getProperties().put("https.proxyHost", "10.10.10.10");
System.getProperties().put("https.proxyPort", "8080");
I know this isn't a best practice, so please suggest a better solution, also if anyone can give me a tip on how to set the authentification I'dd really appreciate it
You can also set proxy username and password using java.net.Authenticator class, but I am not sure if it is not "system wide" setting.
Look here: Authenticated HTTP proxy with Java
If you´re using Spring Java configuration, to configure a JAX-WS Client with Apache CXF (3.x.x), the following code will work:
With apache CXF
Here is the corresponding Spring XML configuration :
Documentation : http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
In order for this to work you should import cxf.xml :
Note that this httpConduit will be enabled for all your CXF clients (if several).
You should configure your conduit name to match only your service Conduit :