You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jason Royals <ca...@fragstealers.com> on 2008/11/15 03:54:02 UTC

Camel, CXF and handling Soap Attachments

Hello all,

I'm using Camel 1.5 and CXF 2.1.3 to proxy some existing services to 
enable applications to call us using SOAP over HTTP - essentially we are 
writing a lightweight integration layer.

We've been thrown a requirement in that we need to proxy a service that 
needs a SOAP attachment (using MTOM but thats arbitrary in this 
context).  So, I set up the CXF proxy to enable MTOM, set up some XSLT 
and thought that would be about all.

However, Camel itself doesn't seem to acknowledge SOAP attachments and 
does not save them in the org.apache.camel.Message as it passes through 
the pipeline.  For example, the first time we do an XSLT transformation, 
the XSLT component gets the javax.xml.soap.SOAPMessage (as passed 
through from CXF), gets the soap body and transforms successfully, but 
then it blows away the SOAPMessage (including the MIME headers and 
attachments) and replaces it with the String transformation result.

Perhaps there is something I'm missing, but does Camel not handle SOAP 
attachments very well?  If it can, are there any tutorials or examples 
anyone can share?

The workaround I have is to save the original SOAPMessage in a 
ThreadLocal, let Camel go and transform it to a String (or whatever) in 
the pipeline, and then merge the transformed XML back into the original 
SOAPMessage before sending it on it's way.  That's OK for now but it 
does feel a bit hackish.

Thanks,
Jason

Re: Camel, CXF and handling Soap Attachments

Posted by Willem Jiang <wi...@gmail.com>.
Can you try to use the MESSAGE data format which just store the CXF
transport layer message into the camel message?
You can get whole stream message from the camel message body.

Willem

On Sat, Nov 15, 2008 at 10:54 AM, Jason Royals
<ca...@fragstealers.com>wrote:

> Hello all,
>
> I'm using Camel 1.5 and CXF 2.1.3 to proxy some existing services to enable
> applications to call us using SOAP over HTTP - essentially we are writing a
> lightweight integration layer.
>
> We've been thrown a requirement in that we need to proxy a service that
> needs a SOAP attachment (using MTOM but thats arbitrary in this context).
>  So, I set up the CXF proxy to enable MTOM, set up some XSLT and thought
> that would be about all.
>
> However, Camel itself doesn't seem to acknowledge SOAP attachments and does
> not save them in the org.apache.camel.Message as it passes through the
> pipeline.  For example, the first time we do an XSLT transformation, the
> XSLT component gets the javax.xml.soap.SOAPMessage (as passed through from
> CXF), gets the soap body and transforms successfully, but then it blows away
> the SOAPMessage (including the MIME headers and attachments) and replaces it
> with the String transformation result.
>
> Perhaps there is something I'm missing, but does Camel not handle SOAP
> attachments very well?  If it can, are there any tutorials or examples
> anyone can share?
>
> The workaround I have is to save the original SOAPMessage in a ThreadLocal,
> let Camel go and transform it to a String (or whatever) in the pipeline, and
> then merge the transformed XML back into the original SOAPMessage before
> sending it on it's way.  That's OK for now but it does feel a bit hackish.
>
> Thanks,
> Jason
>