I just check the test code in Camel 1.x branch
Message inMessage = exchange.getIn();
if(inMessage instanceof CxfMessage) {
CxfMessage message = (CxfMessage) inMessage;
List<Element> elements = message.getMessage().get(List.class);
assertNotNull("We should get the elements here" , elements);
assertEquals("Get the wrong elements size" , elements.size(), 1);
assertEquals("Get the wrong namespace URI" ,
elements.get(0).getNamespaceURI(),
"http://cxf.component.camel.apache.org/");
}
So I think the old Camel 1.3.x code should work in Camel fuse 1.5.1
But for Camel 2.0 the code changed like this
CxfPayload<?> payload = exchange.getIn().getBody(CxfPayload.class);
List<Element> elements = payload.getBody();
assertNotNull("We should get the elements here" , elements);
assertEquals("Get the wrong elements size" , elements.size(), 1);
assertEquals("Get the wrong namespace URI" ,
elements.get(0).getNamespaceURI(),
"http://cxf.component.camel.apache.org/");
Willem
mario_horny wrote:
> Hi guys,
>
> I'm using camel 1.5.1.1 coming with artix 5.5.
>
> I was trying to get back to a code snipped that Willem has provided to me a
> couple of months ago (back when I was still using artix 5.1 with camel
> 1.3.x.x) that showed how to access a message in PAYLOAD mode:
>
> public void process(Exchange exchange) throws Exception {
> Message inMessage = exchange.getIn();
> if(inMessage instanceof CxfMessage) {
> CxfMessage message = (CxfMessage) inMessage;
> List<Element> elements = message.getMessage().get(List.class);
> ....
> }
>
> But it seems that the API has changed in the meanwhile since the
> getMessage() method on CxfMessage class seems to no longer exist. What's the
> API for 1.5.1.1 to access the message ?
>
> Best regards,
> Mario