On 25/09/2007, ICAR <[EMAIL PROTECTED]> wrote: > > Hi. We want to implement the Envelope Wrapper describes in to EIP Book. > In a camel component, we receive a message. Example > > <?xml version="1.0" encoding="UTF-8"?> > <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:tns="http://icar.unibas.it/FreESBee"> > <env:Header> > <tns:test>XXX</tns:test> > </env:Header> > <env:Body> > <tns:greet> > <tns:s>ICAR</tns:s> > </tns:greet> > </env:Body> > </env:Envelope> > > now we want create a message like > > <?xml version="1.0" encoding="UTF-8"?> > <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:tns="http://icar.unibas.it/FreESBee"> > <env:Header/> > <env:Body> > > <tns:test>XXX</tns:test> > </env:Header> > <env:Body> > <tns:greet> > <tns:s>ICAR</tns:s> > </tns:greet> > </env:Body> > > </env:Body> > </env:Envelope> > > i.e.: encapsulate a message into another.. > > we have wrote > > this.from("jbi:service:...") > .process(new ProcessorWrapper()) > .to("log:foo"); > > > private class ProcessorWrapper implements Processor{ > public void process(Exchange exchange) throws Exception { > //WRAPPING LOGIC > } > } > > > how we can thake the whole message (header + body) and put it into the body > of another?
In this particular case the message body is a blob of XML which contains an XML header; so its just a matter of doing the XML wrapping. e.g. using XQuery, XSLT or some JAXB2 code etc. If this is SOAP you might wanna look at using camel-cxf so that CXF can do the SOAP handling and SOAP wrapping/unwrapping etc. -- James ------- http://macstrac.blogspot.com/ Open Source SOA http://open.iona.com
