Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-855

SPRING WEB SERVICES 2.1.3 is not generating content type as application/xop+xml for MTOM.

    Details

    • Type: Defect
    • Status: Resolved
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.2.RC1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Spring ws 2.1.3
      Websphere 8.5.5.1 application server
      JDK 1.6

      Description

      Spring WS isnot generating raw message as below mentioned

      Accept-Encoding: gzip,deflate
      Content-Type: application/soap+xml;charset=UTF-8;action="urn:ihe:iti:2007:RetrieveDocumentSet"
      Content-Length: 1566
      Host: 192.168.6.158:9080
      Connection: Keep-Alive
      User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

      <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
        <!--The following header applies for a Synchronous Web Services Exchange Request 
              Please note that a soap message can only have one header section. -->
        <s:Header>

      Any client accessing this web service expects Content-Type as application/xop+xml.

      Due to this content type mismatch client is not receiving the response ant throwing error as below mentioned

      System.ServiceModel.ProtocolException: The content type application/xop+xml;type="application/soap+xml" of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.”

      XSD
      ------

      <xs:element name="DocumentContent" type="xs:base64Binary"/>

      Spring config


      <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
        	
      		<description>A message factory to support SOAP 1.2</description>
      		<!--  <constructor-arg ref="soapMessageFactory" />		 -->
      		<property name="soapVersion">
      			<util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
      		</property>		
      	</bean>
       
      <bean id="messageReceiver"
      		class="org.springframework.ws.soap.server.SoapMessageDispatcher">
      		<property name="endpointAdapters">
      			<bean
      				class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
      				<property name="marshaller" ref="marshaller" />
      				<property name="unmarshaller" ref="marshaller" />
      			</bean>
      		</property>
      		<property name="endpointMappings" ref="endpointMapping" />
      	</bean>
       
       
      	<bean id="endpointMapping"
      		class="org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping">
      	<!-- 	<property name="messageSenders">
      			<bean
      				class="org.springframework.ws.transport.http.HttpUrlConnectionMessageSender" />
      		</property> -->
      		<property name="postInterceptors">
      			<list>
      							<ref bean="soapEnvelopePayloadInterceptorRef" />
      							
      			</list>
      		</property>
       
      	</bean>
       
       
      	<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
      		<property name="contextPaths">
      			<list>
      				<value>package1</value>
      				<value> package2</value>
      			
      			</list>
      		</property> 	
      		<property name="mtomEnabled" value="true" />

      Please let me know how to fix this issue.

        Activity

        vepanjerigovind Govinda Reddy created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Description
        Spring WS isnot generating raw message as below mentioned

        Accept-Encoding: gzip,deflate
        Content-Type: application/soap+xml;charset=UTF-8;action="urn:ihe:iti:2007:RetrieveDocumentSet"
        Content-Length: 1566
        Host: 192.168.6.158:9080
        Connection: Keep-Alive
        User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
          <!--The following header applies for a Synchronous Web Services Exchange Request
                Please note that a soap message can only have one header section. -->
          <s:Header>

        Any client accessing this web service expects Content-Type as application/xop+xml.

        Due to this content type mismatch client is not receiving the response ant throwing error as below mentioned

        System.ServiceModel.ProtocolException: The content type application/xop+xml;type="application/soap+xml" of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.”

        XSD
        ------
        <xs:element name="DocumentContent" type="xs:base64Binary"/>


        Spring config
        -----

        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
          
        <description>A message factory to support SOAP 1.2</description>
        <!-- <constructor-arg ref="soapMessageFactory" /> -->
        <property name="soapVersion">
        <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
        </property>
        </bean>

        <bean id="messageReceiver"
        class="org.springframework.ws.soap.server.SoapMessageDispatcher">
        <property name="endpointAdapters">
        <bean
        class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
        <property name="marshaller" ref="marshaller" />
        <property name="unmarshaller" ref="marshaller" />
        </bean>
        </property>
        <property name="endpointMappings" ref="endpointMapping" />
        </bean>


        <bean id="endpointMapping"
        class="org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping">
        <!-- <property name="messageSenders">
        <bean
        class="org.springframework.ws.transport.http.HttpUrlConnectionMessageSender" />
        </property> -->
        <property name="postInterceptors">
        <list>
        <ref bean="soapEnvelopePayloadInterceptorRef" />

        </list>
        </property>

        </bean>


        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="contextPaths">
        <list>
        <value>package1</value>
        <value> package2</value>

        </list>
        </property>
        <property name="mtomEnabled" value="true" />



        Please let me know how to fix this issue.
        Spring WS isnot generating raw message as below mentioned

        {noformat}
        Accept-Encoding: gzip,deflate
        Content-Type: application/soap+xml;charset=UTF-8;action="urn:ihe:iti:2007:RetrieveDocumentSet"
        Content-Length: 1566
        Host: 192.168.6.158:9080
        Connection: Keep-Alive
        User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
        {noformat}

        {code:xml}
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
          <!--The following header applies for a Synchronous Web Services Exchange Request
                Please note that a soap message can only have one header section. -->
          <s:Header>
        {code}

        Any client accessing this web service expects Content-Type as application/xop+xml.

        Due to this content type mismatch client is not receiving the response ant throwing error as below mentioned

        System.ServiceModel.ProtocolException: The content type application/xop+xml;type="application/soap+xml" of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.”

        XSD
        ------
        {code:xml}
        <xs:element name="DocumentContent" type="xs:base64Binary"/>
        {code}


        Spring config
        -----
        {code:xml}
        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
          
        <description>A message factory to support SOAP 1.2</description>
        <!-- <constructor-arg ref="soapMessageFactory" /> -->
        <property name="soapVersion">
        <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
        </property>
        </bean>

        <bean id="messageReceiver"
        class="org.springframework.ws.soap.server.SoapMessageDispatcher">
        <property name="endpointAdapters">
        <bean
        class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
        <property name="marshaller" ref="marshaller" />
        <property name="unmarshaller" ref="marshaller" />
        </bean>
        </property>
        <property name="endpointMappings" ref="endpointMapping" />
        </bean>


        <bean id="endpointMapping"
        class="org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping">
        <!-- <property name="messageSenders">
        <bean
        class="org.springframework.ws.transport.http.HttpUrlConnectionMessageSender" />
        </property> -->
        <property name="postInterceptors">
        <list>
        <ref bean="soapEnvelopePayloadInterceptorRef" />

        </list>
        </property>

        </bean>


        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="contextPaths">
        <list>
        <value>package1</value>
        <value> package2</value>

        </list>
        </property>
        <property name="mtomEnabled" value="true" />
        {code}


        Please let me know how to fix this issue.
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.1.5 [ 14349 ]
        arjen.poutsma Arjen Poutsma made changes -
        Assignee Arjen Poutsma [ arjen.poutsma ]
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        I am having problems reproducing this. Can you attach a simple, minimal test case that reproduces this behavior?

        Show
        arjen.poutsma Arjen Poutsma added a comment - I am having problems reproducing this. Can you attach a simple, minimal test case that reproduces this behavior?
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.2 [ 12850 ]
        Fix Version/s 2.1.5 [ 14349 ]
        Hide
        aggiepilot04 Dustin Clark added a comment -

        This is also happening to us in a Grails app and Spring WS 2.2.0. The ContentType header is set correctly while running locally, but running on Weblogic (10.3.6), the header is set to text/xml.

        Weblogic

        <Dec 30, 2014 12:52:45 PM CST> <Notice> <Stdout> <BEA-000000> <2014-12-30 12:52:45,931 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] TRACE MessageTracing.sent  - Sent request [------=_Part_1_370067740.1419965565920
        Content-Type: text/xml; charset=utf-8
        Content-Transfer-Encoding: 8bit
        Content-ID: <soapPart>

        Local

        2014-12-30 12:43:23,021 [http-bio-8081-exec-14] TRACE MessageTracing.sent  - Sent request [------=_Part_4_1021751216.1419965003018
        Content-Type: application/xop+xml; charset=utf-8; type="text/xml"

        Can we re-open?

        Show
        aggiepilot04 Dustin Clark added a comment - This is also happening to us in a Grails app and Spring WS 2.2.0. The ContentType header is set correctly while running locally, but running on Weblogic (10.3.6), the header is set to text/xml. Weblogic <Dec 30, 2014 12:52:45 PM CST> <Notice> <Stdout> <BEA-000000> <2014-12-30 12:52:45,931 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] TRACE MessageTracing.sent - Sent request [------=_Part_1_370067740.1419965565920 Content-Type: text/xml; charset=utf-8 Content-Transfer-Encoding: 8bit Content-ID: <soapPart> Local 2014-12-30 12:43:23,021 [http-bio-8081-exec-14] TRACE MessageTracing.sent - Sent request [------=_Part_4_1021751216.1419965003018 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" Can we re-open?
        Hide
        aggiepilot04 Dustin Clark added a comment -

        Disregard. Pulling in saaj-impl 1.3.23 and preferring application classes for javax.xml.soap.* resolved this issue.

        Show
        aggiepilot04 Dustin Clark added a comment - Disregard. Pulling in saaj-impl 1.3.23 and preferring application classes for javax.xml.soap.* resolved this issue.
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        62d 33m 1 Arjen Poutsma 06/Feb/14 5:45 AM

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            vepanjerigovind Govinda Reddy
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: