Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

REST Receiver adapter XML to JSON conventer Problems number value - SF LMS

Hi,

We want to send data to SuccessFactors LMS using PI Rest adapter.

Unfortunately, we are having problems when Rest adapter converts xml to json.

LMS ODATA StudentID

<Property Name="studentID" Type="Edm.String" MaxLength="999999999" Precision="0"/>

StudentID datatype is String in SF LMS.

SAP system sends these data as number. Rest adapter converts this to JSON integer:

XML

<studentID>66777</studentID>

JSON

"studentID": 66777

LMS system wants JSON like this:


"studentID": "66777"

We have tried Java mapping and module development, however Rest adapter gave errors.

How can we workaround this adapter bug?

ERROR

XML

<?xml version="1.0" encoding="utf-8"?>

<STUDENT_DATA odata.type="String 1" xmlns:prx="urn:sap.com:proxy:AHD:/1SAI/TAS247C1D037C6F789A7507:731">

    <studentID>66733</studentID>

    <firstName>Rıdvan</firstName>

    <lastName>Cakir</lastName>

    <timeZone>Europe/Athens</timeZone>

    <currencyID>TRY</currencyID>

    <studentPhones>

        <phoneDescription>cell</phoneDescription>

        <phoneNumber>551-551-02-05</phoneNumber>

    </studentPhones>

    <studentPhones>

        <phoneDescription>home</phoneDescription>

        <phoneNumber>551-551-02-05</phoneNumber>

    </studentPhones>

</STUDENT_DATA>

JSON

{

   "@odata.type": "#Users",

  "studentID": 66733,

   "firstName": "Rıdvan",

   "lastName": "Cakir",

   "timeZone": "Europe/Athens",

   "currencyID": "TRY",

   "studentPhones": [

      {

         "phoneDescription": "cell",

         "phoneNumber": "551-551-02-05"

      },

      {

         "phoneDescription": "home",

         "phoneNumber": "551-551-02-05"

      }

   ]

}

Success

XML

<?xml version="1.0" encoding="utf-8"?>

<STUDENT_DATA odata.type="String 1" xmlns:prx="urn:sap.com:proxy:AHD:/1SAI/TAS247C1D037C6F789A7507:731">

    <studentID>66s777</studentID>

    <firstName>Rıdvan</firstName>

    <lastName>Cakir</lastName>

    <timeZone>Europe/Athens</timeZone>

    <currencyID>TRY</currencyID>

    <studentPhones>

        <phoneDescription>cell</phoneDescription>

        <phoneNumber>531-551-02-05</phoneNumber>

    </studentPhones>

    <studentPhones>

        <phoneDescription>home</phoneDescription>

        <phoneNumber>551-551-22-05</phoneNumber>

    </studentPhones>

</STUDENT_DATA>

JSON

{

   "@odata.type": "#Users",

  "studentID": "66s777",

   "firstName": "Rıdvan",

   "lastName": "Cakir",

   "timeZone": "Europe/Athens",

   "currencyID": "TRY",

   "studentPhones": [

      {

         "phoneDescription": "cell",

         "phoneNumber": "531-551-02-05"

      },

      {

         "phoneDescription": "home",

         "phoneNumber": "551-551-22-05"

      }

   ]

}

Rıdvan Çakır

Tags:
Former Member
Former Member replied

Hi Rıdvan;

You can change the content type by these configuration parameters, probably it will work;

Module Name: AF_Modules/MessageTransformBean
Parameter Name : Transform.ContentType
Parameter Value : application/json

Best Regards
Hasan

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question