cancel
Showing results for 
Search instead for 
Did you mean: 

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

varun_kasireddy
Explorer
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member666103
Discoverer
0 Kudos

Hi,

are you able to resolve above issue, I am also getting same issue.

varun_kasireddy
Explorer
0 Kudos

Hi Team,

Can you please help with above issue.

Thanks,

Varun

varun_kasireddy
Explorer
0 Kudos

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.

manoj_khavatkopp
Active Contributor
0 Kudos

Have you tried this :