4 Replies Latest reply on Aug 2, 2006 12:24 PM by balakrishna_narla

    Connection refused

    ernie666

      Hi!

      I hope someone can help me solving a problem at calling a webservice from other hosts than the one, JBoss is running on.

      I read the Getting started manual and created a (very simple) session bean which i want to deploy as a webservice. The session bean contains only a single method hello() which shall write "hello" to the output if it is
      called.

      Everything is working fine, the deployment is done and the service works
      but only for calls from the same computer JBoss is running on.
      When I try to call it from my notebook or any other computer, i get
      the following exception:

      java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.hello(Unknown Source)
      at WSClient.main(WSClient.java:40)
      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 java.net.Socket.(Unknown Source)
      at java.net.Socket.(Unknown Source)
      at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:135)
      at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:162)
      at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:118)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:162)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:125)
      at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:126)
      at org.apache.axis.client.Call.invokeEngine(Call.java:3039)
      at org.apache.axis.client.Call.invoke(Call.java:3024)
      at org.apache.axis.client.Call.invoke(Call.java:2619)
      at org.apache.axis.client.Call.invoke(Call.java:2524)
      at org.apache.axis.client.Call.invokeInternal(Call.java:1976)
      at org.apache.axis.client.Call.invoke(Call.java:1917)
      at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:175)
      at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:251)
      ... 2 more

      The client code:

      public class WSClient {
       public static void main(String[] args)
       throws Exception
       {
       URL url =
       new URL("http://localhost:8080/SIApplicationServerEJB/WSBean?wsdl");
      
       QName qname = new QName("http://facades.ejb.applicationServer",
       "WSBean");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
      
       WSEndpoint endpoint = (WSEndpoint)service.getPort(WSEndpoint.class);
      
       endpoint.hello();
       }
      
      }
      


      The exception is thrown at "endpoint.hello();" line.

      Thx. Ernie

        • 1. Re: Connection refused
          raist_majere

          I think your problem is with this line of code:

          new URL("http://localhost:8080/SIApplicationServerEJB/WSBean?wsdl");
          

          which tries to access localhost, not your server. Try to change it to your server's IP or DNS name.


          • 2. Re: Connection refused
            ernie666

            Sorry, I posted the wrong Code-Fragment... it shall be "192.168.0.1".

            • 3. Re: Connection refused
              thomas.diesler

              Can you connect to an webapp on that jboss instance?

              • 4. Re: Connection refused
                balakrishna_narla

                Hi,

                i have the following problem when i try to invoke a web service deployed successfully using a web client.

                21:28:31,765 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
                org.jboss.ws.metadata.wsdl.WSDLException: java.io.IOException: Server returned HTTP response code: 405 for URL: http://192.168.5.128:8080/XXX/XXXX
                at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.getDocument(WSDLDefinitionsFactory.java:204)
                at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:112)
                at org.jboss.ws.metadata.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:273)
                at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:110)
                at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
                at org.jboss.ws.jaxrpc.ServiceImpl.(ServiceImpl.java:96)
                at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
                at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
                at com.osit.webservice.BuilderUtil.testClient(BuilderUtil.java:21)
                at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
                at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:595)
                Caused by: java.io.IOException: Server returned HTTP response code: 405 for URL: http://192.168.5.128:8080/WInbox/WInbox
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1152)
                at java.net.URL.openStream(URL.java:1007)
                at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.getDocument(WSDLDefinitionsFactory.java:187)
                ... 33 more

                I've deployed the WebService developed using JWSDK into JBoss4.0.4 in the form of .WAR file which also contains the test client.

                Any help regarding this will be GREATLY appreciated.