Skip to Content
0

XML attributes conversion problem in PI REST Adapter during XML to JSON, JSON to XML

Jan 06, 2017 at 12:46 PM

178

avatar image

We are working with IDoc to REST scenario which will convert IDoc XML to JSON format During JSON conversion the XML attributes are denoted as "@BEGIN":"1"

e.g: {"EXCHANGE_RATE01":{"IDOC":{"@BEGIN":"1"....

But while giving the same as an input to the PI sender REST Adapter it's failed to generate XML attributes as expected in IDoc XML.

Expected format:

<?xml version="1.0" encoding="UTF-8"?>

<EXCHANGE_RATE01>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

PI Sender REST adapter generated as below:

<?xml version="1.0" encoding="UTF-8"?>

<EXCHANGE_RATE01>

<IDOC>

<EDI_DC40>

Note: Here both are just pass through secarios.

Thanks in advance

Nagesh

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ryan Crosby Jan 06, 2017 at 01:49 PM
0

Hi Nagesh,

I think the system would apply the "@BEGIN" attribute if it is supported by simply referring to it as "BEGIN" in the JSON string if it is supported. If that doesn't work then my guess is that it is not supported on your system. I tried to find any documentation regarding JSON -> XML conversion with attributes but was not successful.

Regards,

Ryan Crosby

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Nagesh,

Just an FYI... I don't think this is supported because I tried this in a fake sample and the system merely created the attribute as an XML element. Maybe you are on a newer version where this is supported but if not you wouldn't be able to do this as a straight pass through. You would have to add a mapping to merge the elements back in as attributes on the receiving side.

Regards,

Ryan Crosby

0