Skip to Content

Issue in converting XML to JSON elments with prefixes in REST receiver channel

Dear SAP Experts,

Below is my scenario & issue which needs expert advise.

Scenario:

  1. We are in SAP PI 7.4
  2. I want to consume REST API’s hosted by third party to update SAP HR Master data. Here the third party accepts data only in JSON format.
  3. Below is the expected JSON payload for updating HR Master data through REST PUT operation.

{

"schemas": [

"urn:ietf:params:scim:schemas:core:2.0:User",

"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",

"urn:ietf:params:scim:schemas:extension:peakon:2.0:User"

],

"employeeNumber": "12345",

"urn:ietf:params:scim:schemas:extension:peakon:2.0:User": {

"emailID": "abc@gmail.com",

"division": "HR"

}

}

Issue:

  1. I am able to configure REST receiver adapter channel to convert xml to JSON expect for element"urn:ietf:params:scim:schemas:extension:peakon:2.0:User".
  2. How can we build xml so that prefix urn:ietf:params:scim:schemas:extension:peakon:2.0 is added to JSON element USER while conversion?

Regards,

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Nov 06, 2019 at 08:01 AM

    Hi ,

    Issue is resolved using below adapter config:

    1. Check checkbox "Convert XML name to JSON Name.

    2. In table "XML to JSON Name " in inputput Name enter "User" & in Target Name enter "

    urn:ietf:params:scim:schemas:extension:enterprise:2.0:User".

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2019 at 01:00 PM

    Hi Santosh!

    I've never tried it myself, but the REST channel provides possibility for namespace mapping during XML to JSON conversion. So, I guess, that you would try to qualify your source fields in XML payload with some namespace and map that namespace to respective JSON namespace in REST channel settings.

    Regards, Evgeniy.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 18, 2019 at 12:33 PM

    Hello Santhosh,

    Can you create an XML and then in turn XSD from the output JSON payload and use it as your target structure? It may contain the required prefixes then.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.