Camel - which pattern to use in order to complete xml with values from other services -


I have an XML, which is similar to the following, in which some elements have been created by the URL. That url is another webservice in which another XML is what I need to do, my XML is to complete with information from the webservice, and I want to achieve it with camel. Example goes here:

Initial xml

  & lt; Root & gt; & Lt; Level11 & gt; Level1.txt & lt; / Level1 & gt; & Lt; Level12 & gt; & Lt; Level21 & gt; Http: // someservice / 11 & lt; / Level21 & gt; & Lt; Level21 & gt; Http: // someservice / 12 & lt; / Level21 & gt; & Lt; / Level12 & gt; & Lt; Level13 & gt; & Lt; Level22 & gt; Http: // someservice / 21 & lt; / Level22 & gt; & Lt; Level22 & gt; Http: // someservice / 22 & lt; / Level22 & gt; & Lt; / Level13> & Lt; / Root & gt;  

http: // someservice is returning an XML that I need to convert to the original XML, for example

Http: // someservice / 11 return

  & lt; Someservice & gt; & Lt; Test & gt; 11 & lt; / Test & gt; & Lt; / Someservice & gt;  

http: // someservice / 12 returns

  & lt; Someservice & gt; & Lt; Test & gt; 12 & lt; / Test & gt; & Lt; / Someservice & gt;  

http: // someservice / 21 returns

  & lt; Someservice & gt; & Lt; Test & gt; 21 & lt; / Test & gt; & Lt; / Someservice & gt;  

http: // someservice / 22 returns

  & lt; Someservice & gt; & Lt; Test & gt; 22 & lt; / Test & gt; & Lt; / Someservice & gt;  

My final XML would be:

  & lt; Root & gt; & Lt; Level11 & gt; Level1.txt & lt; / Level1 & gt; & Lt; Level12 & gt; & Lt; Level21 & gt; & Lt; Someservice & gt; & Lt; Test & gt; 11 & lt; / Test & gt; & Lt; / Someservice & gt; & Lt; / Level21 & gt; & Lt; Level21 & gt; & Lt; Someservice & gt; & Lt; Test & gt; 12 & lt; / Test & gt; & Lt; / Someservice & gt; & Lt; / Level21 & gt; & Lt; / Level12 & gt; & Lt; Level13 & gt; & Lt; Level22 & gt; & Lt; Someservice & gt; & Lt; Test & gt; 21 & lt; / Test & gt; & Lt; / Someservice & gt; & Lt; / Level22 & gt; & Lt; Level22 & gt; & Lt; Someservice & gt; & Lt; Test & gt; 22 & lt; / Test & gt; & Lt; / Someservice & gt; & Lt; / Level22 & gt; & Lt; / Level13> & Lt; / Root & gt;  

So my question is, should I use the best pattern to achieve this result?

This content promotion starts to fit in the EIP. This EIP will allow you to add and expand the original message based on the output of other services. Read about the documentation on the Apache camel site.


Comments

Popular posts from this blog

mysql - How to enter php data into a html multiple select box -

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Cassandra datastax cpp driver - avoiding unnecessary copies -