Hi, Forgot to mention . I cannot use payload factory here because this is just an example I created. and my actual data to be enriched is a huge json response from a backend service.
With Regards, Aditya ---------- Forwarded message ---------- From: aditya shivankar <[email protected]> Date: Tue, Jul 18, 2017 at 12:35 PM Subject: Enrich Json with new elements not working for me .Please guide. To: [email protected] Hi, Enrich Json with new elements not working for me .Please guide. Input request : { "id" : "1", "make" : "NAHB" } I the wso2 flow named eg1.xml . I am trying to enrich the incoming json request with new element "name" processing xml: (eg1.xml) <?xml version="1.0" encoding="UTF-8"?> <api context="/eg1" name="eg1" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="POST GET" uri-template="/hi"> <inSequence> <log level="full"/> <log level="custom"> <property expression="//jsonObject" name="msg1"/> </log> <enrich description=""> <source clone="true" type="inline"> <name xmlns="">Home</name> </source> <target action="child" xpath="//jsonObject"/> </enrich> <log level="custom"> <property expression="//jsonObject" name="msg2"/> </log> <log level="full"/> <respond/> </inSequence> <outSequence/> <faultSequence/> </resource> </api> current output : { "id" : "1", "make" : "NAHB" } Desired output : { "id" : "1", "make" : "NAHB" "name" : "Home" } logger output : Logger1 output(log level full) : LogMediator To: /eg1/hi, MessageID: urn:uuid:2f627daf-ac9c-4492-84ea-2736670724e8, Direction: request, Payload: { "id": "1", "make": "NAHB" } Logger2 output : LogMediator msg1 = <jsonObject> <id>1</id> <make>NAHB</make> </jsonObject> Logger3 output : LogMediator msg2 = <jsonObject> <id>1</id> <make>NAHB</make> <name>Home</name> </jsonObject> Logger4 output(log level full) : LogMediator To: /eg1/hi, MessageID: urn:uuid:2f627daf-ac9c-4492-84ea-2736670724e8, Direction: request, Payload: { "id": "1", "make": "NAHB" } Postman output : { "id": "1", "make": "NAHB" } Regards, Aditya
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
