Thursday, April 12, 2012

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at


If You get below mentioned exception, possible reason could be -

1. Your WSDL url is not correct
2. Your WSDL url is not responding.


Check by hiting the URL into your browser, it should appear as shown below.




Exception :

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:8080/HelloWS?wsdl. It failed with:
                Connection refused: connect.
                at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:162)
                at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:144)
                at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:263)
                at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:226)
                at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:174)
                at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)
                at javax.xml.ws.Service.(Service.java:56)
                at simple.SimpleServiceImplService.(SimpleServiceImplService.java:53)
                at simple.TestClient.main(TestClient.java:17)
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:366)
                at java.net.Socket.connect(Socket.java:529)
                at java.net.Socket.connect(Socket.java:478)
                at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
                at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
                at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
                at sun.net.www.http.HttpClient.(HttpClient.java:233)
                at sun.net.www.http.HttpClient.New(HttpClient.java:306)
                at sun.net.www.http.HttpClient.New(HttpClient.java:323)
                at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
                at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
                at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
                at java.net.URL.openStream(URL.java:1010)
                at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:805)
                at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:262)
                at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:129)
                ... 7 more

How to Publish, Consume a simple web service using Tomcat?