[ 
https://issues.apache.org/jira/browse/CXF-8938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18013785#comment-18013785
 ] 

Freeman Yue Fang commented on CXF-8938:
---------------------------------------

We need to check if MTOM_ENABLED is true for the endpoint, by default it's 
false, so it's not correct to use MTOM attachment anyway here.



> CXF forces XOP for SwA SOAP services
> ------------------------------------
>
>                 Key: CXF-8938
>                 URL: https://issues.apache.org/jira/browse/CXF-8938
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 3.6.2
>            Reporter: Willem Salembier
>            Assignee: Freeman Yue Fang
>            Priority: Major
>         Attachments: swaref.zip
>
>
> 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.
> {code}
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element name="Attachment" type="swaref:swaRef"/>
>                         <xsd:element name="Digest" type="xsd:base64Binary"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
> {code}
> CXF generates the following SOAP message including a {{xop:Include}} tag for 
> the Digest.
> {code}
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>       <soap:Body>
>               <ns2:SecureDocument xmlns:ns2="http://playground.be/sample/v1";>
>                       
> <Attachment>[email protected]</Attachment>
>                       <Digest>
>                               <xop:Include 
> xmlns:xop="http://www.w3.org/2004/08/xop/include"; 
> href="cid:[email protected]"/>
>                       </Digest>
>               </ns2:SecureDocument>
>       </soap:Body>
> </soap:Envelope>
> {code}
> 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. 
> {code}
>     public JAXBAttachmentMarshaller(Collection<Attachment> attachments, 
> Integer mtomThreshold) {
>         super();
>         if (mtomThreshold != null) {
>             threshold = mtomThreshold.intValue();
>         }
>         atts = attachments;
>         isXop = attachments != null;
>     }
> {code}
> 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.
> {code}
>     <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>
> {code}
> This is my reproducer:   [^swaref.zip] 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to