Skip to Content
avatar image
Former Member

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

restjson.png (8.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 16, 2015 at 08:29 AM

    Hi,

    here you don't need to go for java mapping or udf...you can just add those double codes("")..in mapping level for that particular field.


    Capturezzz.PNG (4.6 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You can get this resolved by applying a REST adapter patch, they have given a configuration table by which you can explicitly tell which JSON field is integer, string or array.

      check this:

      Regards

      Ravijeet