Respected Sir,

//jsonOject and $ are printing different jsons at same location in API.

Are not both suppose to have latest json payload,

//jsonObject - latest json payload in xml format

$ -  latest json payload in json format ?

Input json:

{
                "token": "d8ccf265-6651-468f-8d1f-d935c3c7d857",
                "partyId": "2920394"


}

Log print of //jsonObject after enrichment:

<jsonObject>
<a>d8ccf265-6651-468f-8d1f-d935c3c7d857</a>
<b>57</b>
<Value>PartyId</Value>
</jsonObject>

Log print of json-eval($) at same place after enrichment : Value tag missing

{
                "a": "d8ccf265-6651-468f-8d1f-d935c3c7d857",
                "b": "57"

}


Please find attached Rest api "sample.xml"


I am facing this issue , when I have to assign current json payload, to one
element of new json I created in payload factory.

Inside payloadFactory I defined something like this:
{
 "a" : $1 ,
 "b":"thampi"
}

In args,

Type :Expression , Value:$ , evaluator: json

But it is assigning the payload which was present before enrichment.which
is wrong .

Please guide.



.

[image: Inline image 2]


Thanks,
Aditya
<?xml version="1.0" encoding="UTF-8"?>
<api context="/testapi1" name="sample" xmlns="http://ws.apache.org/ns/synapse";>
    <resource methods="POST GET">
        <inSequence>
            <enrich>
                <source clone="true" type="inline">
                    <Value xmlns="">PartyId</Value>
                </source>
                <target action="child" xpath="//jsonObject"/>
            </enrich>
            <enrich>
                <source clone="true" xpath="//jsonObject"/>
                <target type="body"/>
            </enrich>
            <log description="" level="custom">
                <property expression="get-property('$body')" name="property_name1"/>
            </log>
            <log description="" level="custom">
                <property expression="//jsonObject" name="property_name1"/>
            </log>
            <log level="custom">
                <property expression="json-eval($)" name="property_name2"/>
            </log>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to