on 07-05-2019 2:07 PM
Hello all,
We are configuring a PROXY to REST Synchronous scenario in which we have to do XML to JSON payload conversions.
The expected payload is:
"AsnMaterialDetails":[{
"Item":313006063,
"Quantity":10
}]
But the REST adapter is providing the payload as:
"AsnMaterialDetails":{
"Item":313006063,
"Quantity":10
}
I have properly configured the XML/JSON custom rules, where we define the node as an array but it was still not working.
https://blogs.sap.com/2016/01/13/rest-adapter-in-sap-pipo-enhanced-xmljson-conversion/
I followed through this blog where the same issue was mentioned. but it was not yet resolved for me
Any help on the issue would be helpful.
Hi Aditya,
If target structure looks like:
</MessageType>
</AsnMaterialDetails>
<Item>313006063</Item>
<Quantity>10</Quantity>
</AsnMaterialDetails>
</MessageType>
Then in the Receiver REST Communication channel, under Data format > Customer XML/Json Conversion Rules you need to provide below response related details like prefix(ns0), namespace, response message type and Array Type set it to 'true'.
This indeed constructs the Response payload in a Array type object [{...}] and delivers appropriately.
Thanks and Regards - Rajesh PS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Leave the "XML Namespace" and "prefix" blank . Just Define the element name and set array type as true for that , it should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Manoj!
I tried that but it was still not working.
Hi Aditya!
And what does your source XML payload look like?
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Evgeniy!
Thanks for your response. My xml payload which needs to be converted into json is
<AsnMaterialDetails>
<Item/>
<Quantity/>
</AsnMaterialDetails>
I need to define the node "AsnMaterialDetails" as an array type. when the occurrence of the node is 1, then it is not getting considered as an array and thus the third brackets "[]" are missing.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.