Link to home
Start Free TrialLog in
Avatar of Nellios
NelliosFlag for Greece

asked on

Consuming a Web Service from a Java Application using JAX-WS

I am trying to create a web service client. I am using Netbeans 6.0.1 and created the client according to the netbeans documentation. Netbeans is using JAX-WS for that purpose.

I am having the exception shown below and I am in need of help.

Thanx in advance.
com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect
	at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(Unknown Source)
	at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
	at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)
	at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
	at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
	at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
	at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
	at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
	at $Proxy28.doIssuePolicy(Unknown Source)
	at org.ais.products.ExecuteWebService.run(ProductsExport.java:89)
	at org.ais.products.ProductsExport.<init>(ProductsExport.java:43)
	at org.ais.products.ProductsExportData.exportData(ProductsExportData.java:253)
	at org.ais.products.Products.checkDeikthParagoghs(Products.java:2213)
	at org.ais.products.ProductsWriteRead.writeStart(ProductsWriteRead.java:136)
	at org.ais.products.Products.writeControl(Products.java:2874)
	at org.ais.products.ProductsActionListener.actionPerformed(ProductsActionListener.java:68)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
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.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	... 47 more

Open in new window

Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

The WSDL location or web service location you provided doesn't seem to be proper, the Client generation wizard is not able to find it.
Avatar of Nellios

ASKER

The client generation of Netbeans works fine. The exception above rises when the client runs.
Are you sure the webservice is working??? please check that first. connection refused means the server on which the web service has been deployed is not accepting the connection.
Avatar of Nellios

ASKER

>>Are you sure the webservice is working???
No the webservice is not working. What IS working is the "client GENERATION wizzard of Netbeans".

>> The WSDL location or web service location you provided doesn't seem to be proper.
The WSDL location seems to be proper. I am not sure though that the WSDL file is correct (I am not building that myself, it is provided). Maybe the "web service location" inside the wsdl is invalid. I will need to check that.

If the web service is not working then when you try to invoke a operation on that web service the above exception come nothing wrong in that. :)
Avatar of Nellios

ASKER

I feel that we got things a bit confused. So I will try explaining things from scratch.
1) I client of our provides as a web service.
2) I am building a client for that web service on netbeans 6.0
3) The client is created sucessfully using the WSDL on a remote URL.
4) The webservice is running.
5) When I try to run the client, which is invoking an opertation on that web service I get the exception above.

and I am trying to reslove that issue.

After your recommendation about service location etc I dig a bit the WSDL and found the attached lines. I guess that the wsdlsoap address which is http://localhost:9080/servicesClient/services/ClientRegisterPolicy is not valid since the webservice is running on a remote host.

If I change localhost to the IP address of the client I get a timeout.


 <wsdl:service name="ClientRegisterPolicyService">
     <wsdl:port binding="intf:ClientRegisterPolicySoapBinding" name="ClientRegisterPolicy">
       <wsdlsoap:address location="http://localhost:9080/servicesClient/services/ClientRegisterPolicy"/>
    </wsdl:port>
  </wsdl:service>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial