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

Soap MTOM: mtomEnabled=true and XSD schemas=... fails

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
    • Environment:
      OS: Win, Linux
      JDK8

      Description

      Setting mtomEnabled=true and schemas=... causes error:

      spring-ws-content.xml fragment

      	<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
                      <!-- .... -->
      		<property name="schemas" ref="xsdList"/>
      		<property name="mtomEnabled" value="true"/>
      	</bean>
      	<bean id="xsdList" class="org.springframework.beans.factory.config.ListFactoryBean">
                     <!-- ... -->
      

      XSD fragment

           <xs:element name="content" type="xs:base64Binary">
      

      [org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-type.3.1.2: Element 'ns2:content' is a simple type, so it must have no element information item [children].]
      

      It seems that validation against XSD was done after MTOM data replacement.

      Sample project is here:
      https://github.com/mpeterka/spring-ws-mtom
      (Error is in cz.datalite.spring.mtom.client.WebServiceClientTest#testMarshall call.)

      Expected behaviour is:

      1. Validate XML message according to XSD.
      2. Replace content of data element with MTOM include tag.
      3. Send SOAP message.

      Disabling message validation is only known workaround.

        Activity

        martin.peterka Martin Peterka created issue -
        martin.peterka Martin Peterka made changes -
        Field Original Value New Value
        Description Setting _mtomEnabled=true_ and _schemas=..._ causes error:

        {code:xml}
        <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
                        <!-- .... -->
        <property name="schemas" ref="xsdList"/>
        <property name="mtomEnabled" value="true"/>
        </bean>
        <bean id="xsdList" class="org.springframework.beans.factory.config.ListFactoryBean">
                       <!-- ... -->
        {code}


        {noformat}
        [org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-type.3.1.2: Element 'ns2:content' is a simple type, so it must have no element information item [children].]
        {noformat}


        It seems that validation against XSD was done *after* MTOM data replacement.

        *Sample project is here:*
        [https://github.com/mpeterka/spring-ws-mtom]
        (Error is in {{cz.datalite.spring.mtom.client.WebServiceClientTest#testMarshall}} call.)

        *Expected behaviour is:*
        # Validate XML message according to XSD.
        # Replace content of data element with MTOM include tag.
        # Send SOAP message.

        Disabling message validation is only known workaround.
        Setting _mtomEnabled=true_ and _schemas=..._ causes error:

        {code:xml|title=spring-ws-content.xml fragment}
        <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
                        <!-- .... -->
        <property name="schemas" ref="xsdList"/>
        <property name="mtomEnabled" value="true"/>
        </bean>
        <bean id="xsdList" class="org.springframework.beans.factory.config.ListFactoryBean">
                       <!-- ... -->
        {code}
        {code:xml|title=XSD fragment}
             <xs:element name="content" type="xs:base64Binary">
        {code}


        {noformat}
        [org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-type.3.1.2: Element 'ns2:content' is a simple type, so it must have no element information item [children].]
        {noformat}


        It seems that validation against XSD was done *after* MTOM data replacement.

        *Sample project is here:*
        [https://github.com/mpeterka/spring-ws-mtom]
        (Error is in {{cz.datalite.spring.mtom.client.WebServiceClientTest#testMarshall}} call.)

        *Expected behaviour is:*
        # Validate XML message according to XSD.
        # Replace content of data element with MTOM include tag.
        # Send SOAP message.

        Disabling message validation is only known workaround.

          People

          • Assignee:
            Unassigned
            Reporter:
            martin.peterka Martin Peterka
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: