3 Replies Latest reply on Dec 2, 2011 3:57 AM by adinn

    Cannot unmarshall SOAPMessage

    ppoliani

      I have the following client which is created with the aid of  apache CFX within SOAPUI :

       

       

      /** Code taken from jbossts xts example */
                System.out.println("CLIENT: obtaining userTransaction...");
      
                UserTransaction ut = UserTransactionFactory.userTransaction();
      
                System.out.println("CLIENT: starting the transaction...");
      
                try {
      
                     ut.begin();
                } catch (WrongStateException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                } catch (SystemException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                }
      
                System.out.println("CLIENT: transaction ID= " + ut.toString());
      
                System.out.println("CLIENT: calling business Web Services...");
      
      
                {
                     /** Calling flight web service */
                     System.out.println("Invoking checkFlightAvailability...");
                     System.out.println("Dummy Implementation of operation checkAvailability in FlightService");
                     FlightRequestInfo req = new FlightRequestInfo();
                     req.setDestination("Athens");
                     FlightStatus status = flightAT.checkFlightAvailability(req);
      
                     System.out.println("Flight service checkFlightAvailability the source city is="
                               + status.getSource() + "\n");
      
                }
                
                 System.out.println("CLIENT: calling commit on the transaction...");
      
               try {
                     ut.commit();
                } catch (Exception e) {
                     
                }
      

      The transaction starts sucessfully because i can see the result of System.out.println("CLIENT: transaction ID= " + ut.toString());

       

      However, when i call the service FlightStatus status = flightAT.checkFlightAvailability(req);

      i get the following exception:

      22:42:25,354 ERROR [SOAPMessageUnMarshallerHTTP] Cannot unmarshall SOAPMessage
      javax.xml.soap.SOAPException: Unsupported content type: text/html; charset=UTF-8
        • 1. Re: Cannot unmarshall SOAPMessage
          ppoliani

          Actually i have noticed that the root of the problem is the invokation of UserTransactionFactory.userTransaction().toString(); on the service side

          This is what i noticed looking at the stack trace:

           

          javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit message
               org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:396)
               org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
               $Proxy381.checkFlightAvailability(Unknown Source)     
                  org.comp6017.Client.testTransaction(Client.java:212)
               org.comp6017.Client.doGet(Client.java:145)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          root cause
          
          java.io.IOException: Could not transmit message
               org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:265)
               org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
               org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
               org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
               $Proxy381.checkFlightAvailability(Unknown Source)
               org.comp6017.Client.testTransaction(Client.java:212)
               org.comp6017.Client.doGet(Client.java:145)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          root cause
          
          org.jboss.remoting.CannotConnectException: Can not connect http client invoker after 1 attempt(s)
               org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:249)
               org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:161)
               org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
               org.jboss.remoting.Client.invoke(Client.java:1724)
               org.jboss.remoting.Client.invoke(Client.java:629)
               org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
               org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
               org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
               org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
               $Proxy381.checkFlightAvailability(Unknown Source)
               org.comp6017.Client.testTransaction(Client.java:212)
               org.comp6017.Client.doGet(Client.java:145)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          root cause
          
          java.io.IOException: javax.xml.soap.SOAPException: Unsupported content type: text/html; charset=UTF-8
               org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:90)
               org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:570)
               org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:369)
               org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:231)
               org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:161)
               org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
               org.jboss.remoting.Client.invoke(Client.java:1724)
               org.jboss.remoting.Client.invoke(Client.java:629)
               org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
               org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
               org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
               org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
               $Proxy381.checkFlightAvailability(Unknown Source)
               org.comp6017.Client.testTransaction(Client.java:212)
               org.comp6017.Client.doGet(Client.java:145)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          root cause
          
          javax.xml.soap.SOAPException: Unsupported content type: text/html; charset=UTF-8
               org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:272)
               org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:82)
               org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:570)
               org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:369)
               org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:231)
               org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:161)
               org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
               org.jboss.remoting.Client.invoke(Client.java:1724)
               org.jboss.remoting.Client.invoke(Client.java:629)
               org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
               org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
               org.jboss.ws.core.CommonClient.invoke(CommonClient.java:340)
               org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
               org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
               $Proxy381.checkFlightAvailability(Unknown Source)
               org.comp6017.Client.testTransaction(Client.java:212)
               org.comp6017.Client.doGet(Client.java:145)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
               javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          

          As you might see, in bold is the operation i am calling.

           

          Can anyone help, why does UserTransactionFactory.userTransaction().toString(); fails?

          • 2. Re: Cannot unmarshall SOAPMessage
            ppoliani

            To give you some more information, i run the client in debug mode. I noticed that the exception was thrown by the method:

            ClientProxy.invloke( Object, Method, Object[] )line:156

             

            I have created the service with maven 2 inside eclipse, i followed the WSDL to java approach with the aid of apache CXF and i run jboss 5.1.0.GA

             

            I think there is some confict among libraries used by jboss and CXF by this is just a guess.

             

            Does anyone know what is wrong with that. I have been searching for days and still got no solution.

            • 3. Re: Cannot unmarshall SOAPMessage
              adinn

              Pavlos Polianidis wrote:

               

              To give you some more information, i run the client in debug mode. I noticed that the exception was thrown by the method:

              ClientProxy.invloke( Object, Method, Object[] )line:156

               

              I have created the service with maven 2 inside eclipse, i followed the WSDL to java approach with the aid of apache CXF and i run jboss 5.1.0.GA

               

              I think there is some confict among libraries used by jboss and CXF by this is just a guess.

               

              Does anyone know what is wrong with that. I have been searching for days and still got no solution.

               

              The original error was

               

              javax.xml.soap.SOAPException: Unsupported content type: text/html; charset=UTF-8
                   org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:272)
                   org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:82

              . . .

               

              This means that the remoting code is dispatching the JaxWSrequest to your  web service and receiving an unexpected response. This suggests to me that the web service may be the root of the problem. You could try debugging the web service implementation class to see if it the correct method is invoked and whether it is indeed returning a valid result.

               

              Is your service deployed as a JaxWS endpoint?

               

              Can you see the deployed service WSDL in a browser (type the service URL followed by ?wsdl).

               

              Does the service WSDL match the WSDL used by the client?

              1 of 1 people found this helpful