7 Replies Latest reply on Aug 25, 2011 12:50 PM by adrigan

    Call a Web Service out of a Web Application

    riffi

      I try to call a web service method out of a web application. We use a JBOSS 5.1 for our web application. The web service is installed on an external Glassfish Server.

      The webservice client classes are imported as Jar-archive in the web application. In normal Java-Apps it works without any problems.

       


      This Exception will occur:

      14:14:52,921 ERROR [CommonClient] Exception caught while (preparing for) performing the invocation:
      java.io.IOException: Could not transmit message
          at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:265)
          at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
          at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
          at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
          at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
          at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
          at $Proxy389.getNewDocumentList(Unknown Source)
          at com.ods.eva3.pda.xml.sql.webservice.PdaWebService.getNewDocumentList(PdaWebService.java:403)
          at com.ods.eva3.pda.PDA_XmlImportieren.doImportieren(PDA_XmlImportieren.java:54)
          at com.optadata.evasync.PDAImportExportThread.syncClient(PDAImportExportThread.java:87)
          at com.optadata.evasync.PDAImportExportThread.run(PDAImportExportThread.java:58)
      Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker after 1 attempt(s)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:249)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:161)
          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
          ... 10 more
      Caused by: java.net.SocketException: Unexpected end of file from server
          at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
          at java.net.HttpURLConnection.getResponseCode(Unknown Source)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.getResponseCode(HTTPClientInvoker.java:1238)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:339)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:231)
          ... 15 more
      14:14:52,921 SEVERE [global] null Es konnte keine Dokumentenliste herruntergeladen werden!
      javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit message
          at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:396)
          at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
          at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
          at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
          at $Proxy389.getNewDocumentList(Unknown Source)
          at com.ods.eva3.pda.xml.sql.webservice.PdaWebService.getNewDocumentList(PdaWebService.java:403)
          at com.ods.eva3.pda.PDA_XmlImportieren.doImportieren(PDA_XmlImportieren.java:54)
          at com.optadata.evasync.PDAImportExportThread.syncClient(PDAImportExportThread.java:87)
          at com.optadata.evasync.PDAImportExportThread.run(PDAImportExportThread.java:58)
      Caused by: java.io.IOException: Could not transmit message
          at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:265)
          at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
          at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
          at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
          ... 7 more
      Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker after 1 attempt(s)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:249)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:161)
          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
          ... 10 more
      Caused by: java.net.SocketException: Unexpected end of file from server
          at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
          at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
          at java.net.HttpURLConnection.getResponseCode(Unknown Source)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.getResponseCode(HTTPClientInvoker.java:1238)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:339)
          at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:231)
          ... 15 more

        • 1. Re: Call a Web Service out of a Web Application
          jim.ma
          Can you use wireshark or tcpmon to log the http header and soap message ?  Then paste here , we can analysis. Thanks.
          • 2. Re: Call a Web Service out of a Web Application
            riffi

            It seems to be an authentification problem with the glassfish server. The JBoss tries to use a authentification which the glassfish doesn't support. The glassfish server use a basic authentification. I installed the last JBOSSWS  3.2.2 GA and

            got the following Stacktrace:

             

            12:45:41,546 WARNING [AssertionBuilderRegistryImpl] No assertion builder for type {http://schemas.xmlsoap.org/ws/2004/10/wsat}ATAlwaysCapability registered.
            12:45:41,546 WARNING [AssertionBuilderRegistryImpl] No assertion builder for type {http://schemas.xmlsoap.org/ws/2004/10/wsat}ATAssertion registered.
            12:45:41,562 WARNING [PhaseInterceptorChain] Interceptor has thrown exception, unwinding now
            org.apache.cxf.interceptor.Fault: None of the policy alternatives can be satisfied.
                at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:47)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
                at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
                at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
                at $Proxy412.getNewDocumentList(Unknown Source)
                at com.ods.eva3.pda.xml.sql.webservice.PdaWebService.getNewDocumentList(PdaWebService.java:403)
                at com.ods.eva3.pda.PDA_XmlImportieren.doImportieren(PDA_XmlImportieren.java:54)
                at com.optadata.evasync.PDAImportExportThread.syncClient(PDAImportExportThread.java:87)
                at com.optadata.evasync.PDAImportExportThread.run(PDAImportExportThread.java:58)
            Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.
                at org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative(EffectivePolicyImpl.java:151)
                at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:87)
                at org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy(PolicyEngineImpl.java:155)
                at org.apache.cxf.ws.policy.PolicyOutInterceptor.handle(PolicyOutInterceptor.java:110)
                at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:45)
                ... 11 more
            12:45:42,828 SEVERE [global] null Es konnte keine Dokumentenliste herruntergeladen werden!
            javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can be satisfied.
                at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
                at $Proxy412.getNewDocumentList(Unknown Source)
                at com.ods.eva3.pda.xml.sql.webservice.PdaWebService.getNewDocumentList(PdaWebService.java:403)
                at com.ods.eva3.pda.PDA_XmlImportieren.doImportieren(PDA_XmlImportieren.java:54)
                at com.optadata.evasync.PDAImportExportThread.syncClient(PDAImportExportThread.java:87)
                at com.optadata.evasync.PDAImportExportThread.run(PDAImportExportThread.java:58)
            Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.
                at org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative(EffectivePolicyImpl.java:151)
                at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:87)
                at org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy(PolicyEngineImpl.java:155)
                at org.apache.cxf.ws.policy.PolicyOutInterceptor.handle(PolicyOutInterceptor.java:110)
                at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:45)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
                at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
                at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
                ... 5 more

            • 3. Re: Call a Web Service out of a Web Application
              riffi

              The solution is to use the right JBossWS Stack.

               

              I installed the JBossWS-Metro http://www.jboss.org/jbossws/downloads.html and it works.

               

              The question is why does the JBoss uses the JBossWS as WS-Client classes?

              • 4. Call a Web Service out of a Web Application
                ombagwu

                Hello,

                 

                I am having similar issues and i'm looking for solution to the problem. Please have a look at my thread at

                http://community.jboss.org/thread/164582

                Also I'll like to know in bits what you did to solve your problem. I have downloaded the JbossWS-metro but don't have a clue how to use it with Jboss.

                • 5. Call a Web Service out of a Web Application
                  riffi

                  Be sure that you use the right Jboss-WS stack.

                  If you want to connect to a Glassfish WS use the Metro stack.

                   

                  Install the Stack into jboss.

                  Download the Stack extract to your filesystem.

                  Configuere the ant.properties and target.properties

                   

                  Download ant http://ant.apache.org/

                  run ant to install the Stack into your jboss.

                  • 6. Call a Web Service out of a Web Application
                    ombagwu

                    Thank you so much, I tried it and it worked. I'm deeply appreciative of your help.

                    • 7. Re: Call a Web Service out of a Web Application
                      adrigan

                      Thank you.  The answer to your post got my client running!  I appreciate your taking the time to answer your own problem on this post.  It helped me and probably many others.  Blessings to you! 

                       

                      By the way - here is a link that gives all the details of installing a new web service stack.

                      http://community.jboss.org/wiki/JBossWS-Installation