Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8938

CXF forces XOP for SwA SOAP services

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.6.2
    • None
    • JAXB Databinding
    • None
    • Unknown

    Description

      CXF seems to force xop:Include tags for web services that don't require or activate MTOM, but use SOAP with Attachments (SwA).

      The goal of this type is to send the document as a mime part attachment, but the digest of the file should just be a base64 encoded string in the SOAP body.

                      <xsd:complexType>
                          <xsd:sequence>
                              <xsd:element name="Attachment" type="swaref:swaRef"/>
                              <xsd:element name="Digest" type="xsd:base64Binary"/>
                          </xsd:sequence>
                      </xsd:complexType>
      

      CXF generates the following SOAP message including a xop:Include tag for the Digest.

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      	<soap:Body>
      		<ns2:SecureDocument xmlns:ns2="http://playground.be/sample/v1">
      			<Attachment>5e0b9189-8ba0-4159-a4cd-3bac838cdc84@apache.org</Attachment>
      			<Digest>
      				<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:136ebfc9-72d9-4887-8548-267a24678228-1@cxf.apache.org"/>
      			</Digest>
      		</ns2:SecureDocument>
      	</soap:Body>
      </soap:Envelope>
      

      This behavior seems to come from org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller which forces that any attachment list (even when it is empty) activates XOP.

          public JAXBAttachmentMarshaller(Collection<Attachment> attachments, Integer mtomThreshold) {
              super();
              if (mtomThreshold != null) {
                  threshold = mtomThreshold.intValue();
              }
              atts = attachments;
              isXop = attachments != null;
          }
      

      XOP shouldn't be the default. In cxf.xml, I tried disabling MTOM, but I cannot get rid of the XOP tags. I didn't find a way to retrieve and customize the JAXBAttachmentMarshaller instance neither.

          <jaxws:client name="{http://playground.be/sample/v1}SampleSOAP11" createdFromAPI="true" address="http://localhost:8080">
              <jaxws:properties>
                  <entry key="mtom-enabled" value="false"/>
              </jaxws:properties>
          </jaxws:client>
      

      This is my reproducer: swaref.zip

      Attachments

        1. swaref.zip
          4 kB
          Willem Salembier

        Activity

          People

            Unassigned Unassigned
            wsalembi Willem Salembier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: