Skip to Content
0

Rest Receiver Adapter - XML to JSON issue - HTTP error occurred: Unprocessable Entity

Jan 27 at 03:39 AM

159

avatar image
Former Member

Hi Team,

My Scenario is Proxy to Rest and I am facing issue in converting XML to JSON format Error is : HTTP error occurred: Unprocessable Entity, Below is the target structure

Target Structure

Adapter Screenshot

I am getting this additional node "Data" in the output, how do I remove it

{"Data":[{"FinancialTransactionKey":311,"CompanyCode":"US9V","StatusCode":"ERR"},
{"FinancialTransactionKey":769,"CompanyCode":"US9V","DocumentNumber":"6778","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":123,"CompanyCode":"test1","DocumentNumber":"123","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":1234,"CompanyCode":"test2","DocumentNumber":"456","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":6879,"CompanyCode":"test3","DocumentNumber":"780","FiscalYear":2018,"StatusCode":"COM"}]}

Expected Output is

[{"FinancialTransactionKey":311,"CompanyCode":"888","StatusCode":"ERR"},
{"FinancialTransactionKey":769,"CompanyCode":"666","DocumentNumber":"6778","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":123,"CompanyCode":"test1","DocumentNumber":"123","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":1234,"CompanyCode":"test2","DocumentNumber":"456","FiscalYear":2018,"StatusCode":"COM"},
{"FinancialTransactionKey":6879,"CompanyCode":"test3","DocumentNumber":"780","FiscalYear":2018,"StatusCode":"COM"}]
structure.jpg (33.9 kB)
rest-adapter.jpg (98.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Vadim Klimov Jan 28 at 09:53 AM
0

Hi Varun,

Have a look in the SAP Note 2465948 - it introduces new parameter 'setIgnoredElements' for REST adapter, which you can make use of to ignore specific XML elements when producing JSON output. Using this parameter, you can instruct REST receiver communication channel to ignore / remove specific fields (such as 'Data', in your example) that are present in the XML version of the message, from the JSON version of the message.

Regards,

Vadim

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

Hi Vadim,

Firstly, sorry for the late response.

Good news is, you suggested Note/Module worked as expected.

Appreciate your help, thanks a lot.

Varun

0