Skip to Content
0

Syncronous Scenario: How to convert response JSON to XML using Rest Adapter

4 days ago

52

avatar image

Hi Team,

I am working on a Synchronous flow Proxy to Rest Adapter using GET method to fetch the records.

I am able to make the successful request and when I get the response in Return, Its in JSON format which is causing my mapping failure.

In Rest Receiver Adapter, Data Format Tab, Response Format for Synchronous messages, If I select data format as JSON, I am getting error as

"MP: exception caught with cause com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'

at [row,col {unknown-source}]: [1,1]"

If I select XML format, I get the response in JSON format, and mapping mails as it expects an XML structure.

Sample JSON Response:

{
"Data": [
{
"ID": 1,
"OverrideDateDueIndicator": false,
"BusinessUnitCode": "US",
"ReferenceNumber": "54",
"JournalID": "QRS",
"TransactionType": "GL",
"AccountNumber": "1234",
"AccountingMonth": "2015-07-01T00:00:00",
"ActivityDate": "2015-05-01T00:00:00",
"TransactionAmount": -4480.00,
"TransactionVolume": 0.00,
"TransactionVolumeUnitOfMeasure": "MCF",
"RevenueGrossAmount": 0.00,
"RevenueGrossVolume": 0.00,
"SourceDescription": "GL from Revenue",
"SourceDate": "2015-10-02T00:00:00",
"SinglePaymentIndicator": false,
"NonopJIBVoucherIndicator": false,
"OwnerBANumber": "00123",
"OwnerBASub": 1,
"Quantity1Amount": 0.0000000000,
"ArchiveCounter": 3,
"ProcessQueueID": 33455,
"BatchID": "1",
"AccountTypeCode": "EX"
},
{
"ID": 2,
"OverrideDateDueIndicator": false,
"BusinessUnitCode": "UV",
"ReferenceNumber": "5455",
"JournalID": "QRS",
"TransactionType": "GL",
"AccountNumber": "1300",
"AccountingMonth": "2015-07-01T00:00:00",
"ActivityDate": "2015-05-01T00:00:00",
"TransactionAmount": 480.00,
"TransactionVolume": 0.00,
"TransactionVolumeUnitOfMeasure": "MCF",
"RevenueGrossAmount": 0.00,
"RevenueGrossVolume": 0.00,
"SourceDescription": "GL from Revenue",
"SourceDate": "2015-10-02T00:00:00",
"SinglePaymentIndicator": false,
"NonopJIBVoucherIndicator": false,
"PropertyNumber": "test",
"MajorProductCode": "ALL",
"DivisionOrderType": "REV",
"Tier": 1,
"Quantity1Amount": 0.0000000000,
"ArchiveCounter": 3,
"CostCenter": "test",
"ProcessQueueID": 358,
"BatchID": "1",
"AccountTypeCode": "IN"
}

],

"Messages": []
}

Please advise how my response source structure should look like, and how Rest Adapter should be configured to convert JSON to XML format

rest-receiver-adapter-screenshot.jpg
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Manoj K 4 days ago
0

Have you tried this :


rest.png (9.8 kB)
Share
10 |10000 characters needed characters left characters exceeded
Varun K 4 days ago
0

Hi Manoj,

Thanks for the response. I did try with the above options. When I select JSON as response format, I get below error. I tried with different combinations but no luck.

My PI version is 7.31 SP 19, so I don't have last option convert to XML 1.1 document.


error.jpg (83.3 kB)
Share
10 |10000 characters needed characters left characters exceeded
Varun K 2 days ago
0

Hi Team,

Can you please help with above issue.

Thanks,

Varun

Share
10 |10000 characters needed characters left characters exceeded