You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2016/01/08 18:38:00 UTC

CXF MTOM attachments Camel access

Hello.

I'm doing first tests of SOAP services with MTOM attachments, using CXF, in
PAYLOAD mode. I thing I've good XSD and WSDL, and have some doubts about
attachments using Camel ?

I've found no clear example of Camel uses, and none using Blueprint DSL.

Here is a copy of the CXF log of the SOAP request with a simple XML request
and a single attached text file.



The Camel body is actually what I expect, retrieving the SOAP payload :



But the Camel attachments (in.getAttachments()) seem a bit strange, with a
name (key) "*Attachment-Request-1.txt*" and its value
"*javax.activation.DataHandler@7902d19e*".

The name of the attachment seems to be the filename of the attached file,
but gives no apparent way to be retrieved from the given XML body element
value : "*<inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include"
href="cid:498747099018"/>*".

*Question #1*
How can I get the attachment name from the XML element ? In this simple
case, only one attachment is posted. In real cases, several documents may be
associated to the operation. The CID of the attachment should be a more
useless key to get it, no ? Is it a normal CXF/Camel behavior ?

*Question #2*
I've noted that the incoming attachement, if nothing is done is
automatically reused in the response which, in my case, also allows to
return a document. Is it a board effect of the in and out bodies chaining ?
A simple statement like "*exchange.getOut().getAttachments().clear()*" may
solve the problem...

Some examples, in Blueprint DSL if possible, may help a bit.

Any idea or advice ?...

Thanks in advance.

Regards.



--
View this message in context: http://servicemix.396122.n5.nabble.com/CXF-MTOM-attachments-Camel-access-tp5723342.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: CXF MTOM attachments Camel access

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.
I've done more tests, and I've found why the attachment key appears to be
bad : it was an error of mine using soapUI attachments. Changing the related
content id in the request to match the attachment part of the body, it works
as expected. I hope that SOAP frameworks client do it well too...
I've also succeeded to use the attachment itself from the Camel message
attachment, getting the DataHandler input stream to simply save it (it's
just an example) to a file endpoint. Indeed, it seems that the file (file2)
component knows how handle an input stream to write a file...
A question stays open : do CXF and Camel component support streaming of the
attached parts ? I've read ambiguous posts about the "non-ordering" of parts
in MTOM exchanges. What is the good way to get big attached files without
loading them entirely and stream them to some output target (file, outgoing
SOAP call, etc.) ?
Thanks again for your help.
Regards.



--
View this message in context: http://servicemix.396122.n5.nabble.com/CXF-MTOM-attachments-Camel-access-tp5723342p5723343.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.