0 Replies Latest reply on Oct 15, 2012 3:35 AM by Radomír Kadlec

    How to validate messages with MTOM attachments?

    Radomír Kadlec Newbie

      Hello

      I have SOAP message with MTOM attachments.

      The message is consumed in a cxfbc-consumer like this:

          <cxfbc:consumer   

              service="service"

              endpoint="endpoint"

              locationURI="$"

              wsdl="$"

              targetService="targetService"

              targetEndpoint="targetEndpoint"

              schemaValidationEnabled="true"

              delegateToJaas="true"

              properties="#properties"

              providedBus="#cxf"

              mtomEnabled="true"       

              >

       

      The xml element containing the attachment is defined in the wsdl:

        <xs:element name="myAttachment" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>

       

      Wehen the message validation is enabled, then this fault occurs, when the cxfbc-consumer receives message with MTOM attachment:

               <faultstring>cvc-type.3.1.2: Element 'myAttachment' is a simple type, so it must have no element information item .</faultstring>

       

      This is because the xml element in the message contains link to the attachment instead of the binary data (so is it in the MTOM standard):

       

       

      What must I do to validate such messages with MTOM attachments?

      Is the wsdl/xsd definition of the message wrong?

      I made it exactly as in MTOM examples on FuseESB site. But in this exaples is the validation disabled.

       

      I use apache-servicemix-4.4.1-fuse-07-11 in OSGI deployment.

       

      Thank you for any tips.

      Radomir

       

      Edited by: kadlec on Oct 15, 2012 7:34 AM