9 Replies Latest reply on Apr 9, 2008 5:18 PM by thomas.diesler

    NullPointerException when processing response

    boopet

      JBoss AS version: 4.0.5GA

      Hi everyone,

      we have created a JBossWS Client with version 2.0.1 consuming a Axis2 webservice, that is sending its responses in multipart/related format.
      The client uses the UserNameToken authentification.

      when the client is processing the ws answer, i get a NullPointer Exception because of some security issue:

      javax.xml.ws.WebServiceException: java.lang.NullPointerException
       at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.processHandlerFailure(HandlerChainExecutor.java:276)
       at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:155)
       at org.jboss.ws.core.jaxws.client.ClientImpl.callResponseHandlerChain(ClientImpl.java:168)
       at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:363)
       at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
       at $Proxy24.loadEloFileUrl(Unknown Source)
       at com.giag.fo.elo.giagws.service.EloWsClientTest.testGetFileUrl(EloWsClientTest.java:110)
       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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
       at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
       at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874)
       at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
       at org.testng.TestRunner.runWorkers(TestRunner.java:689)
       at org.testng.TestRunner.privateRun(TestRunner.java:566)
       at org.testng.TestRunner.run(TestRunner.java:466)
       at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
       at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
       at org.testng.SuiteRunner.run(SuiteRunner.java:191)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
       at org.testng.TestNG.run(TestNG.java:701)
       at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
       at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
      Caused by: java.lang.NullPointerException
       at org.jboss.ws.extensions.security.Util.matchNode(Util.java:188)
       at org.jboss.ws.extensions.security.Util.matchNode(Util.java:183)
       at org.jboss.ws.extensions.security.Util.findElement(Util.java:89)
       at org.jboss.ws.extensions.security.WSSecurityDispatcher.handleInbound(WSSecurityDispatcher.java:115)
       at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleInboundSecurity(WSSecurityHandler.java:78)
       at org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient.handleInbound(WSSecurityHandlerClient.java:40)
       at org.jboss.ws.core.jaxws.handler.GenericHandler.handleMessage(GenericHandler.java:55)
       at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:295)
       at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:140)
      
      

      can sbd give an advice?

      thanks in advance!
      norbert

        • 1. Re: NullPointerException when processing response
          pramod_bs

          It seems like the client is not sending the header. I think you can use some tool like tcpmon (https://tcpmon.dev.java.net/) to see what is going out of your port.

          • 2. Re: NullPointerException when processing response
            boopet

            hm our client is sending the wsse headers and authentification by UserNameToken is ok.

            The result returned by the server does not include any wsse information, which should also be OK.

            but the stacktrace leads to the assumption, that the jboss WS client tries to find some wsse information in the answer anyway.

            • 3. Re: NullPointerException when processing response
              pramod_bs

              Here are some code snippets from JBoss code. I am not sure if you already loked at this. If not you can use eclipse debugger to see what is coming in the parameters. I am assuming the header is null. I might be wrong. Try it out.

              WSSecurityDispatcher.java
              
              public static void handleInbound(CommonMessageContext ctx) throws SOAPException, SOAPFaultException
               {
               WSSecurityConfiguration config = getSecurityConfig(ctx);
               SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
              
               SOAPHeader soapHeader = soapMessage.getSOAPHeader(); QName secQName = new QName(Constants.WSSE_NS, "Security");
               Element secHeaderElement = Util.findElement(soapHeader, secQName);
              
              
              
              
              Util.java
              
               public static Element findElement(Element root, QName name)
               {
               // Here lies your standard recusive DFS.....
               if (matchNode(root, name))
               return root;
              
              
              
               public static boolean matchNode(Node node, QName name, boolean local)
               {
               return equalStrings(node.getLocalName(), name.getLocalPart())
               && (local || equalStrings(node.getNamespaceURI(), name.getNamespaceURI()));
               }
              




              • 4. Re: NullPointerException when processing response
                boopet

                yes i could check this with debugger.
                the strange thing is: why is the WSSecurityDispatcher invoked at all, when there is no security information inside the response ?

                Or does JBossWS just simply require a wsse tag inside the response, when the request had those?

                • 5. Re: NullPointerException when processing response
                  pramod_bs

                  R u sure you handleInbound is invoked with the response. I think this is invoked while you send the message from the client. Check it out.

                  • 6. Re: NullPointerException when processing response
                    boopet

                    well i am not sure, but my tcpmon shows the request and also the
                    response , so i think the request has been processed properly.

                    • 7. Re: NullPointerException when processing response
                      thomas.diesler

                      Please show us the client security config and the incomming response message

                      • 8. Re: NullPointerException when processing response
                        boopet

                        this is the jboss-wsse-client.xml used:

                        <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://www.jboss.com/ws-security/config
                         http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
                         <config>
                         <username/>
                        
                        
                         </config>
                         </jboss-ws-security>


                        The Response received from the server is:

                        HTTP/1.1 200 OK
                        Date: Wed, 02 Apr 2008 09:38:28 GMT
                        Transfer-Encoding: chunked
                        Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_3A2968402D531FD9601207129108996; type="application/xop+xml"; start="<0.urn:uuid:3A2968402D531FD9601207129108997@apache.org>"; start-info="text/xml"
                        Server: Apache-Coyote/1.1
                        
                        --MIMEBoundaryurn_uuid_3A2968402D531FD9601207129108996
                        Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
                        Content-Transfer-Encoding: binary
                        Content-ID: <0.urn:uuid:3A2968402D531FD9601207129108997@apache.org>
                        
                        <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:loadEloFileUrlResponse xmlns:ns="http://somecompany.com"><ns:return>http://myurl.com</ns:return></ns:loadEloFileUrlResponse></soapenv:Body></soapenv:Envelope>
                        --MIMEBoundaryurn_uuid_3A2968402D531FD9601207129108996--


                        • 9. Re: NullPointerException when processing response
                          thomas.diesler

                          If this still occurs with the latest, could you please create a jira issue that allows us to reproduce what you are seeing