Hi,

I need to access a webservice using proxy.

I have the proxy Ip and port.

I have created HttpTransportProperties.ProxyProperties object and I have set
this property on ServiceClient options object as shown below.

 

        serviceClient = new ServiceClient(null, definition, serviceName,
portName);

        HttpTransportProperties.ProxyProperties proxyProperties =
getProxyProperties();

 
serviceClient.getOptions().setProperty(HTTPConstants.PROTOCOL_VERSION,
HTTPConstants.HEADER_PROTOCOL_10);

        serviceClient.getOptions().setProperty(HTTPConstants.PROXY,
proxyProperties);

 

But at the rum time I got this exception.

- Unable to sendViaPost to url[http://new.wssdemo.com/_vti_bin/lists.asmx]

java.net.ConnectException: connect: Address is invalid on local machine, or
port is not valid on remote machine

            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:366)

            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(DelegatingMethodAccessorImpl
.java:25)

            at java.lang.reflect.Method.invoke(Method.java:585)

            at
org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(
ReflectionSocketFactory.java:139)

            at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSo
cket(DefaultProtocolSocketFactory.java:124)

            at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)

            at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnect
ionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)

            at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethod
Director.java:386)

            at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDir
ector.java:170)

            at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)

            at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)

            at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTT
PSender.java:520)

            at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)

            at
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)

            at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:327)

            at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:206)

            at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)

            at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:374)

            at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:211)

            at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

 

 

After that I have set all the proxy parameters as System Properties but this
time I got a different exception.

 

caused by

org.apache.axis2.AxisFault: Transport error: 501 Error: Not Implemented

            at
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:29
8)

            at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192)

            at
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)

            at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:327)

            at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:206)

            at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)

            at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:374)

            at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:211)

            at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

            at
com.fiorano.services.webserviceconsumer.engine.WSClient.invoke(WSClient.java
:210)

 

 

 

Is this the correct way to use a preconfigured proxy. Please help.

 

 

Thanks

--Phani

Reply via email to