2 Replies Latest reply: May 10, 2012 4:35 AM by Jeremy Whiting RSS

    Problem: Unsupported content type: text/plain

    Nizar Garrache Newbie

      Hello,

       

      We have a working EAR deployed on a JBoss EAP 5.1 and using Seam 2.2.2EAP5 and JBossWS 3.1.2.SP7.

       

      We implemented a Soap Client which doesn't work if the received response has the HTTP header: content-type: text/plain.

      If this header is not found or equal to text/xml the soap client works.

       

      Here is the top of the stack trace:

       

       

      22:52:27,454 ERROR [SOAPMessageUnMarshallerHTTP] Cannot unmarshall SOAPMessage
      javax.xml.soap.SOAPException: Unsupported content type: text/plain
           at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:272)
           at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:82)
           at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:584)
           at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:381)
           at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:232)
           at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:162)
           at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:167)
           at org.jboss.remoting.Client.invoke(Client.java:2034)
           at org.jboss.remoting.Client.invoke(Client.java:877)
           at org.jboss.remoting.Client.invokeOneway(Client.java:926)
           at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:228)
           at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
           at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:360)
           at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:231)
           at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:171)
           at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:157)
           at $Proxy427.beginConversation(Unknown Source)
           at com.oberthur.issuersimulator.session.TsmSpSimulatorBean.beginConversationRequest(TsmSpSimulatorBean.java:431)
           at com.oberthur.issuersimulator.session.TsmSpSimulatorBean.beginConversationKeyRotation(TsmSpSimulatorBean.java:164)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationCont
      
      

       

       

      Please, can you help me ?

       

      Please note, that we want to accept the text/plain type.

       

      Thanks,

       

      Nizar,

        • 1. Re: Problem: Unsupported content type: text/plain
          Nizar Garrache Newbie

          Hi,

           

          I found the following in the source code of JBossWS 3.1.2.SP7 (MessageFactoryImpl.java)

           

          else if (isSoapContent(contentType) == false)
          {
               throw new SOAPException("Unsupported content type: " + contentType);
          }
          

           

          private boolean isSoapContent(ContentType type)
          {
               String baseType = type.getBaseType();
               return MimeConstants.TYPE_SOAP11.equalsIgnoreCase(baseType) || MimeConstants.TYPE_SOAP12.equalsIgnoreCase(baseType);
          }
          

           

          And in MimeConstants.java

           

          public static final String TYPE_TEXT_XML = "text/xml";
          public static final String TYPE_SOAP11 = TYPE_TEXT_XML;
          public static final String TYPE_SOAP12 = "application/soap+xml";
          

           

          So technically what I want to do is impossible

           

          Now I'm tryng to patch this classes until the partner update its server.

          • 2. Re: Problem: Unsupported content type: text/plain
            Jeremy Whiting Expert

            Hi Nizar,

              When you receive a content type of "text/plain" it is indicitive of an error in the request sent by the web service client.

             

            There should be an error message in the http response. Can you capture that and provide the information? Capture can be achieved using a tool such as Wireshark or TCP/IP Monitor in Eclipse.

             

            Regards,

            Jeremy