wood burning stoves*
The moose likes Web Services and the fly likes My First Basic Web Service Client - AxisFault Connection refused: connect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "My First Basic Web Service Client - AxisFault Connection refused: connect" Watch "My First Basic Web Service Client - AxisFault Connection refused: connect" New topic
Author

My First Basic Web Service Client - AxisFault Connection refused: connect

chris sam
Greenhorn

Joined: Aug 21, 2010
Posts: 3
I have deployed a hello world web service running on a tomcat server on my home system. From the browser, I was able to test using wsdl url and it is accessible from the browser.

I have generated the stub using WSDL2Java and wrote a sample test client to connect to a web service and getting the following error:

Please suggest.

Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: connect
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.jav
a:203)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
geWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
monsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisO
peration.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(Out
InAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:
165)
at net.roseindia.HelloWorldServiceStub.sayHello(HelloWorldServiceStub.ja
va:184)
at net.roseindia.Test.main(Test.java:14)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.create
Socket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
reateSocket(DefaultProtocolSocketFactory.java:125)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java
:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$Http
ConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt
pMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe
thodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abst
ractHTTPSender.java:542)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.jav
a:199)
... 9 more

thanks in advance.
sal sathya
Greenhorn

Joined: Jul 28, 2010
Posts: 11
HI,
I hope you already find the solution for the same problem that i also got,
"Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: conne
ct
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.jav
a:203)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessa
geWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Com
monsHTTPTransportSender.java:225)"

the solution for this after you publish the service we can see the list of services in my case its "http://localhost:8080/axis2/services/HelloWorldService"
then in the clientside a Test.java is there put the same in the constructor for example
public class Test {
public static void main(String[] args) throws Exception {
HelloWorldServiceStub stub = new HelloWorldServiceStub("http://localhost:8080/axis2/services/HelloWorldService");
//Create the request
-----------------------------------
-------------------------


that all
Thank you
Mircea Cadariu
Greenhorn

Joined: Jul 16, 2011
Posts: 1
I have bumped into the same error message described in the last two posts and don't know what to do next. Has anyone encountered this message and found a viable solution to the issue?

I have put the correct web service address into the constructor of the stub, but the error described in the last two posts still persists. I have disabled windows firewall and the anti-virus when I tried running the program.

Thanks in advance.
Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi Mates,

I cannot answer directly your question but I hope this would help..

Well, I haved used this book to learn about Apache Axis.. link

The first 2 chapters are free..they refer to the setup needed to run the service. I advised you to buy the book as it is a simple read and can be finished on a weekend reading.

Regards!


Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: My First Basic Web Service Client - AxisFault Connection refused: connect
 
Similar Threads
Web services in HTTPS. org.apache.axis2.AxisFault: Read timed out
Axis2 NoSuchMethodError
need help org.apache.axis2.AxisFault: Read timed out exception
Unable to sendViaPost to url
can't run rampart client