1 Reply Latest reply on Jul 5, 2019 7:36 AM by Naveent_2785

    REST adapter BPEL 12c

    Naveent_2785

      Hi,

       

      I was trying to pass translated string( xml to native json) to a JSON Rest reference created in BPEL 12c but it is failing with a 400 bad request. Have observed that JSON payload sent in the request is containing "/n" new line character and escape characters. How can we fix this?

       

      Steps followed to reproduce this issue:

       

      1)Create a REST reference(without choosing the WSDL interface)

      2)Configure the REST bindings with JSON payload in the Request and Response

      3)A native schema is created with a sample JSON ( payload to be sent to the REST reference)

      4)In the BPEL, two JSON string variables are created for request/response to the REST reference

      5)In the BPEL a translate activity is used to translate the input xml to the required JSON native schema and stored in a output string.

      6) Assign the output string to the JSON request variable of the REST reference.

       

      After testing the invoke is failing with the bad request having the following JSON payload:

       

      Expected:

      [ {

        "keys" : {

          "Id" : "Test-F37C-11e6-8508-005056B8246"

        },

        "values" : {

          "First_Name" : "Warren",

          "Middle_Name" : null,

          "Last_Name" : "Buffeti",

          "Title" : "MRS",

          "Birthdate" : null,

          "Gender" : "MALE",

          "Email_Address" : "TEST@iip.com",

          "Email_Verfication_Code" : "NOT_VERIFIED",

          "Mobile" : "3453466453",

          "Mobile_Verfication_Code" : "NOT_VERIFIED NOT_VERIFIED",

          "Email_comms_consent" : "false",

          }

      } ]

       

      Actual:

      [ { \n  \"keys\" : {\n    \"Id\" : \"Test-F37C-11e6-8508-005056B8246\"  \n }, \n  \"values\" : { \n    \"First_Name\" : \"Warren\", \n    \"Middle_Name\" : null, \n    \"Last_Name\" : \"Buffeti\", \n    \"Title\" : \"MRS\", \n     \"Birthdate\" : null, \n     \"Gender\" : \"MALE\",  \n    \"Email_Address\" : \"TEST@iip.com\", \n   \"Email_Verfication_Code\" : \"NOT_VERIFIED\", \n    \"Mobile\" : \"3453466453\", \n    \"Mobile_Verfication_Code\" : \"NOT_VERIFIED NOT_VERIFIED\", \n   \"Email_comms_consent\" : \"false\", \n   }}]

       

      How to format the above json payload properly before sending to rest reference.

       

      Thanks,

      Naveen.