Reputation: 311
I am new to Camel and I am stuck at a point which seems to be simple. I have a requirement of unmarshalling 2 xml's that are in my exchange and then pass the corresponding POJO's to a processor. I am thinking if I could unmarshall one xml, set it to a property in exchange and repeat same for another xml. Finally in processor I will retrieve the properties and can perform the needed logic in processor. I am able to successfully unmarshall the xml's and also get the last POJO in exchange.in.body. But can anyone tell me what is the correct way to set the result of unmarshalled object in exchange property? I tried below but it doesnt work :
<setProperty propertyName="foo">
<unmarshall ref="modelref" id="model_id"" />
</setProperty>
here modelref is a ref to bean of org.apache.camel.model.dataformat.JAXBDataFormat class from camel.
Can anyone give me some pointers to fix this?
Upvotes: 0
Views: 1286
Reputation: 1527
Unmarshal is not a valid child-element of the setProperty-element. Provided that you've already performed some sort of split and now want to unmarshal one of your XMLs and set as a header you'd do something like this:
<unmarshal ref="modelref" id="model_id" />
<setProperty propertyName="foo">
<simple>${body}</simple>
</setProperty>
Upvotes: 1