Hi Aditya, You can enrich the AggregateMediator response using input request without as below.
Inside the iterate mediator store the input payload in a property as below. <iterate id="1" expression="//jsonArray/jsonElement"> <target> <sequence> <property name="input" expression="//jsonElement" scope="default"/> <send> <endpoint key="modifyAgrRespEP"/> </send> </sequence> </target> </iterate> In the outSequence, before aggregate, you can enrich the backend response with the above property value. <enrich> <source clone="true" xpath="$ctx:input/make"/> <target action="child" xpath="//jsonObject"/> </enrich> . . <aggregate id="1"> . Thanks, Manorama On Wed, Jul 19, 2017 at 4:30 PM, aditya shivankar < shivankar.adit...@gmail.com> wrote: > Input request : > > [ > { > "id" : "1", > "make" : "TAHB" > }, > { > "id" : "2", > "make" : "Tonda" > }, > { > "id" : "3", > "make" : "Tamsung" > } > ] > > > I am using iterate, to send each element of above array as request to a > backend service( In myactual project this is not so simple service i.e. its > reponse is very complex with lots of arrays and sub-arrays(child arrays)in > it . for better understanding of issue I kept it like this ). > > The responses of the backend service are aggregated in one soap xml by > AggregateMediator. > > Below is response from AggregateMediator > > <?xml version='1.0' encoding='utf-8'?> > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ > "> > <soapenv:Body> > <Information> > <jsonObject> > <id>3</id> > <name>Mobile</name> > <model>S8</model> > </jsonObject> > <jsonObject> > <id>2</id> > <name>Car</name> > <model>Tmaze</model> > </jsonObject> > <jsonObject> > <id>1</id> > <name>Home</name> > <area>5000sqft</area> > </jsonObject> > </Information> > </soapenv:Body> > </soapenv:Envelope> > > I want to enrich above response from AggregateMediator like below using > input request. > i.e. I want to merge input request and output of backend service.(id is > common between them.) > > > <?xml version='1.0' encoding='utf-8'?> > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ > "> > <soapenv:Body> > <Information> > <jsonObject> > <id>3</id> > <name>Mobile</name> > <model>S8</model> > <make>Tamsung</make> > </jsonObject> > <jsonObject> > <id>2</id> > <name>Car</name> > <model>Tmaze</model> > <make>Tonda</make> > </jsonObject> > <jsonObject> > <id>1</id> > <name>Home</name> > <area>5000sqft</area> > <make>TAHB</make> > </jsonObject> > </Information> > </soapenv:Body> > </soapenv:Envelope> > > > I kept input request array in a property before calling backend services > and was able to access it in response flow. > but the problem is both request and response are arrays. How could I run > two foreach on two different arrays simultaneously and also match their id > before updating each array element of response. > > Please find attachments. > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Manorama Perera Software Engineer WSO2, Inc.; http://wso2.com/
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev