简体   繁体   中英

Issue while consuming axis2 webservice behind proxy

My server is in a network where all the internet request are to go through proxy. I have configured proxy for my jvm with -Dhttp.proxy.. system properties. When the webservice (which is on internet) is accessed, I get following error:

org.apache.axis2.AxisFault: Connection refused
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:221)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
        at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)

What could be the solution for the same?

Have you tried setting the proxy properties in code with:

System.setProperty("http.proxyHost", host);
System.setProperty("http.proxyPort", port);

// Maybe these are required now
AxisProperties.setProperty("http.proxyHost", host);
AxisProperties.setProperty("http.proxyPort", port);

Just make sure these properties are set before any axis call is made. This may seem obvious but you might face problems when you set the properties on a 'retry' kind of call afterwards .

Did you tell axis to use a proxy? I think axis doesn't know yet. Just setting the global jvm properties will not tell axis to use this proxy.

Did you try checking the connection to the proxy is good with some other tool? Check for Host/Post/User/Password etc.,

Otherwise, try changing the network connection of the host to use proxy and try hitting.

(I know, I'm just trying to debug the issue here) ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM