File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes unable to call a web service  using axis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "unable to call a web service  using axis" Watch "unable to call a web service  using axis" New topic
Author

unable to call a web service using axis

mehercharan pindiprolu
Greenhorn

Joined: Feb 14, 2006
Posts: 3
Hi All,
I am trying to access a webservice with end point url outside my proxy(http://www.spraci.com/services/soap/index.php). I am unable to access it.

I get a Connect Exception. I am giving my proxy host and port. still i get the same exception.

Please help me,i am struck in consuming any web service from internet.


My code looks like this:
try {
String endpoint ="http://www.spraci.com/services/soap/index.php";

java.security.Security.setProperty("http.proxyHost","192.168.192.50");
java.security.Security.setProperty("http.proxyPort","8080");
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName("INSERT");
String ret = (String) call.invoke( new Object[] { "Hello!" } );
}

Stack trace:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection refused: connect
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
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:324)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at com.test.TestClient.main(TestClient.java:27)

{http://xml.apache.org/axis/}hostname:S104F82

java.net.ConnectException: Connection refused: connect
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at com.test.TestClient.main(TestClient.java:27)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
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:324)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
... 10 more


Regards,
Meher
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Can you reach that endpoint through the proxy with your browser?

Also, is that really an Axis endpoint? "index.php" does not look very "Java-ish".


Ping & DNS - my free Android networking tools app
mehercharan pindiprolu
Greenhorn

Joined: Feb 14, 2006
Posts: 3
Hi,
First of all thanks for trying to help me.
yes i am able to reach the end point through Browser.
I have taken the end point address from soap address location of the service tag ( from WSDl).

when i gave a wrong end point Url its giving me
404 resource cannot be found


Regards,
Meher
mehercharan pindiprolu
Greenhorn

Joined: Feb 14, 2006
Posts: 3
Hi,
Even i changed my end point Url which i could access from browser to

[URL= http://www.webservicex.net/usaddressverification.asmx] http://www.webservicex.net/usaddressverification.asmx[/url].

and operation name to :
VerifyAddress


Still i get the same stack trace that i posted earlier.
I see this as a security exception.
Please help me.

Regards,
Meher
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
I see - you're using Axis on the client. Well, it's a network problem, with the connection being refused. Can you access other web services through the proxy?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to call a web service using axis