BPM, Workflow, and Case

  • 1.  IBM BAW BPMRESTRequest to DataPower Invalid JSON in Body

    Posted Fri August 20, 2021 05:43 PM
    I am sending a BPMRESTRequest to retrieve a token from DataPower. 

    The JSON validator finds the body is valid JSON, and the body works when sent through Postman, but the request fails in BAW with: 

    {"httpStatusCode":500,"httpStatusMessage":"Internal Server Error","content":"{\"error\":\"env:Client Internal Error (from client), Invalid JSON format\",\"error_description\":\"Invalid JSON format, The body of the request, which was expected to be JSON, was invalid, and could not be decoded. The start of an object '{' or an array '[' was expected and instead a % was found.\"}"}

    Any ideas why this could be happening?


    ------------------------------
    Ailin Cao
    Associate Application Developer
    IBM
    ------------------------------


  • 2.  RE: IBM BAW BPMRESTRequest to DataPower Invalid JSON in Body

    Posted Mon August 23, 2021 11:15 AM

    I haven't integrated with DataPower myself, but given the error message, my thought would be that your request is getting HTTP URL encoded somehow. Instead of the request containing the starting "{" it is getting encoded as "%7B"

    Any additional info you can provide, like a screenshot of the script where BPMRESTRequest is being invoked and your postman request (Be sure to blur out any baseURLs) will be helpful for me or anyone else to be able have a better idea of what is going on.

    You may also want to see about logging the BPMRESTRequest object before sending the request to see what it looks like and if things still look as expected, you would then need to set up your trace to enable the BAW platform to log what it is sending so you can see exactly what is sent.



    ------------------------------
    Rackley Boren
    ------------------------------



  • 3.  RE: IBM BAW BPMRESTRequest to DataPower Invalid JSON in Body

    Posted Sun September 05, 2021 03:51 AM
    Thanks for the support! It turns out the body wasn't being passed in the request because BAW needs the body to be formatted as

    request.parameters = { "body": {"sampleParameter": "sampleParameterValue"}}.

    I had left out the "body" part.

    ------------------------------
    Ailin Cao
    Associate Application Developer
    IBM
    ------------------------------