How is your process triggered?
In fact BPEL uses XML, so JSON will be transformed to XML.
In your case I would use the REST adapter to
Then use a BPEL for loop on every occurence in the customer list.
For every customer-id use another REST adapter to fetch the orders for that customer and process those in another for loop.
Make sure you create a BPEL 2.0 process. Then you can use the for-each loop. That is quite convenient.
Hope this helps?
thanks Martien, how I store those xml response into one XML in the database, that I am not sure.
Today for every API we get one response ans we store it.
Do you have a data model present in the database? Or do you need to store them as xml files?
In either way, you'll need to use the database adapter to do so. If you have a datamodel, then the database adapter will create an xsd for every insert you'll define. Depending on the datamodel you might need to do an insert for the customer and an other insert for the orders. Thus 2 adapters. Perhaps you could do it in one Database adapter insert, when you can define a parent-child relation between the customer and the orders.
If you need to insert it as an xml into the database in a CLOB column for instance, then you'll need the XSD that defines the XML. You can then use an XSLMap to transform to the correct XML format. And then do an insert.
May be I did not put my question correctly,
for 1 customer I get 5orders
for those 5orders we will make 5 payment API calls which result 5 xml response.
I need these 5 response xml merge into one XML and save into database as single xml in xmltype column.
Ah, You'll need to create a variable based on the XSD of the single xml type.
Let's say it has a structure like
The first payment you'll just use a regular assign copy-rule to /payments/payment. For every subsequent payment, you'll need another assign with a copy rule with /payments as a target, but change the rule to append:
So you'll need an if around it to check on the index. Or maybe you could do also an append for the first one. You should try that.
Thanks for this information, I will try to implement this solution and then will comeback.