You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jiang Liu <S3...@student.rmit.edu.au> on 2007/02/23 04:16:26 UTC
[Axis2] problem with proxy setting
Hi experts
Sorry for openning a new thread, i did have this question long time before, but i guess i should re-state it more clear. I have firewall setting behind, so everything connection requires proxy setting. My proxy has no problem and i did follow the Axis2 Library 161 (http://wso2.org/library/161), anyway, i did both way but all failed.
I tried to consume Global Weather service from webservicex (http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=48), here is my client source:
package net.webservicex.www;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.*;
public class Client {
public static void main(String[] args) {
try {
HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
proxyProperties.setProxyName("proxy.cs.rmit.edu.au");
proxyProperties.setProxyPort(8080);
proxyProperties.setDomain("proxy.cs.rmit.edu.au");
proxyProperties.setPassWord("tl111822");
proxyProperties.setUserName("ljiang");
//in order to makesure that we use HTTP 1.0
Options options = new Options();
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
HTTPConstants.HEADER_PROTOCOL_10);
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY,
proxyProperties);
GlobalWeatherStub stub = new GlobalWeatherStub();
GetWeatherDocument reqDoc = GetWeatherDocument.Factory.newInstance();
GetWeatherDocument.GetWeather req = reqDoc.addNewGetWeather();
req.setCityName("Melbourne");
req.setCountryName("Australia");
GetWeatherResponseDocument resDoc = stub.GetWeather(reqDoc);
System.out.println("Get result: " + resDoc.getGetWeatherResponse().getGetWeatherResult());
}
catch(Exception e) {
e.printStackTrace();
}
}
}
And here are the exceptions that i got:
C:\Documents and Settings\ljiang\Desktop\weather\client\build\classes>java -Djav
a.ext.dirs=h:\lib net.webservicex.www.Client
- I/O exception (java.net.ConnectException) caught when processing request: Conn
ection refused: connect
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing request: Conn
ection refused: connect
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing request: Conn
ection refused: connect
- Retrying request
org.apache.axis2.AxisFault: Connection refused: connect; nested exception is:
java.net.ConnectException: Connection refused: connect; nested exception
is:
org.apache.axis2.AxisFault: Connection refused: connect; nested exceptio
n is:
java.net.ConnectException: Connection refused: connect
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
monsHTTPTransportSender.java:227)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisO
peration.java:237)
at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAx
isOperation.java:202)
at net.webservicex.www.GlobalWeatherStub.GetWeather(GlobalWeatherStub.ja
va:325)
at net.webservicex.www.Client.main(Client.java:35)
Caused by: org.apache.axis2.AxisFault: Connection refused: connect; nested excep
tion is:
java.net.ConnectException: Connection refused: connect
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
geWithCommons(CommonsHTTPTransportSender.java:344)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
monsHTTPTransportSender.java:204)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.create
Socket(ReflectionSocketFactory.java:139)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
reateSocket(DefaultProtocolSocketFactory.java:124)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java
:706)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt
pMethodDirector.java:386)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe
thodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abst
ractHTTPSender.java:541)
at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPS
ender.java:119)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
geWithCommons(CommonsHTTPTransportSender.java:335)
... 6 more
Obviously the fault was caused by 3 failure connections. Any suggestion?
Cheers!!
------------------------------
Jiang Liu
Student Number: 3075163
CS/Yallara Name: ljiang
RMIT, Melbourne
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] problem with proxy setting
Posted by Tony Ambrozie <to...@gmail.com>.
I would recommend that you use a tool like soapUI to call the services, and
set the proxy parameters exactly as above. That will tell you if you can
actually connect to the proxy and pass the auth challenge.
Thanks'
On 2/22/07, Jiang Liu <S3...@student.rmit.edu.au> wrote:
>
> Hi experts
> Sorry for openning a new thread, i did have this question long time
> before, but i guess i should re-state it more clear. I have firewall setting
> behind, so everything connection requires proxy setting. My proxy has no
> problem and i did follow the Axis2 Library 161 (
> http://wso2.org/library/161), anyway, i did both way but all failed.
>
> I tried to consume Global Weather service from webservicex (
> http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=48), here is my
> client source:
>
> package net.webservicex.www;
> import org.apache.axis2.client.Options;
> import org.apache.axis2.transport.http.*;
>
> public class Client {
> public static void main(String[] args) {
> try {
> HttpTransportProperties.ProxyProperties proxyProperties =
> new HttpTransportProperties.ProxyProperties();
>
> proxyProperties.setProxyName("proxy.cs.rmit.edu.au
> ");
> proxyProperties.setProxyPort(8080);
> proxyProperties.setDomain("proxy.cs.rmit.edu.au");
> proxyProperties.setPassWord("tl111822");
> proxyProperties.setUserName("ljiang");
>
> //in order to makesure that we use HTTP 1.0
> Options options = new Options();
> options.setProperty(
> org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
> HTTPConstants.HEADER_PROTOCOL_10);
>
> options.setProperty(
> org.apache.axis2.transport.http.HTTPConstants.PROXY,
> proxyProperties);
>
> GlobalWeatherStub stub = new GlobalWeatherStub();
> GetWeatherDocument reqDoc =
> GetWeatherDocument.Factory.newInstance();
> GetWeatherDocument.GetWeather req =
> reqDoc.addNewGetWeather();
> req.setCityName("Melbourne");
> req.setCountryName("Australia");
> GetWeatherResponseDocument resDoc =
> stub.GetWeather(reqDoc);
> System.out.println("Get result: " +
> resDoc.getGetWeatherResponse().getGetWeatherResult());
> }
> catch(Exception e) {
> e.printStackTrace();
> }
> }
> }
>
>
> And here are the exceptions that i got:
>
>
> C:\Documents and Settings\ljiang\Desktop\weather\client\build\classes>java
> -Djav
> a.ext.dirs=h:\lib net.webservicex.www.Client
> - I/O exception (java.net.ConnectException) caught when processing
> request: Conn
> ection refused: connect
> - Retrying request
> - I/O exception (java.net.ConnectException) caught when processing
> request: Conn
> ection refused: connect
> - Retrying request
> - I/O exception (java.net.ConnectException) caught when processing
> request: Conn
> ection refused: connect
> - Retrying request
> org.apache.axis2.AxisFault: Connection refused: connect; nested exception
> is:
> java.net.ConnectException: Connection refused: connect; nested
> exception
> is:
> org.apache.axis2.AxisFault: Connection refused: connect; nested
> exceptio
> n is:
> java.net.ConnectException: Connection refused: connect
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
> monsHTTPTransportSender.java:227)
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
> at org.apache.axis2.description.OutInAxisOperationClient.send
> (OutInAxisO
> peration.java:237)
> at org.apache.axis2.description.OutInAxisOperationClient.execute
> (OutInAx
> isOperation.java:202)
> at net.webservicex.www.GlobalWeatherStub.GetWeather(
> GlobalWeatherStub.ja
> va:325)
> at net.webservicex.www.Client.main(Client.java:35)
> Caused by: org.apache.axis2.AxisFault: Connection refused: connect; nested
> excep
> tion is:
> java.net.ConnectException: Connection refused: connect
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
> geWithCommons(CommonsHTTPTransportSender.java:344)
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
> monsHTTPTransportSender.java:204)
> ... 5 more
> Caused by: java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java
> :195)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
> at java.net.Socket.connect(Socket.java:507)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.commons.httpclient.protocol.ReflectionSocketFactory.create
> Socket(ReflectionSocketFactory.java:139)
> at
> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
> reateSocket(DefaultProtocolSocketFactory.java:124)
> at org.apache.commons.httpclient.HttpConnection.open(
> HttpConnection.java
> :706)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt
> pMethodDirector.java:386)
> at org.apache.commons.httpclient.HttpMethodDirector.executeMethod
> (HttpMe
> thodDirector.java:170)
> at org.apache.commons.httpclient.HttpClient.executeMethod(
> HttpClient.jav
> a:396)
> at org.apache.commons.httpclient.HttpClient.executeMethod(
> HttpClient.jav
> a:346)
> at
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abst
> ractHTTPSender.java:541)
> at org.apache.axis2.transport.http.SOAPOverHTTPSender.send
> (SOAPOverHTTPS
> ender.java:119)
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
> geWithCommons(CommonsHTTPTransportSender.java:335)
> ... 6 more
>
> Obviously the fault was caused by 3 failure connections. Any suggestion?
>
> Cheers!!
> ------------------------------
> Jiang Liu
> Student Number: 3075163
> CS/Yallara Name: ljiang
> RMIT, Melbourne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>