Skip to Content
2
Former Member
Mar 30, 2015 at 11:03 AM

JSON to XML conversion in receiver REST communication channel

1705 Views

Hi Experts,

I am currently working on a Proxy to REST (synchronous) scenario, and have used SAP's REST adapter in the receiver communication channel.

I am using the GET operation here on the 'Waste-streams' resource of the target system's REST API, and am trying to retrieve all the Waste Streams for which the ChapterCode field is '01'.

This REST service of the target's system seems to be accepting the source message in XML format, but sends back a response message in the JSON format only. Hence I need to convert this JSON response into an XML structure that would match the response data type that I have created in the ESR. However, in this JSON to XML conversion, I am getting the following error:

com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.rest.ejb.json.ConverterException: Error validating JSON input at com.sap.aii.af.app.listener.AFWListenerBean.onMessage

A JSONObject text must begin with '{' at character 1 of [{"ChapterCode":"01","Description":"wastes resulting from exploration,mining,quarrying,and physical and chemical treatment of minerals","StreamCode":"","SubChapterCode":""},{.... (followed by the entire JSON payload that the REST service sends back.

Below are the details that I have used in the Data Format tab of my receiver communication channel:

Here, 'Response' is the root node of the Message type created in the ESR to accept the response message that the service sends back.

Please can someone help me out in resolving this issue.

Regards,

Jyotika.

Attachments