Visual Builder

Get Involved. Join the Conversation.

Topic

    Stephen Bryant
    Getting Uncaught TypeError calling Web ServiceAnswered
    Topic posted June 18, 2019 by Stephen BryantBronze Trophy: 5,000+ Points, tagged Action Flows, Custom Code, REST, UI, Web 
    80 Views, 10 Comments
    Title:
    Getting Uncaught TypeError calling Web Service
    Summary:
    Error Occurs even though the Webservice brings back data
    Content:

    Hello,

    I am getting this error when calling a web service I created that brings data back to vbcs via an OTBI Report. 

    ---Uncaught TypeError: Cannot read property 'Column0' of null

    Integration Cloud calls the SAW Soap Service that gets the OTBI Report and maps the result to the Rest Service that returns the formatted JSON as follows:

    {
        "rowset": [
            {
                "Column0": "Duplicate-10002",
                "Column1": "2019-01-05",
                "Column2": "Invoice is missing invoice lines and needs completion.",
                "Column3": "2019-01-09",
                "Column4": "1",
                "Column5": "SYSTEM",
                "Column6": "250",
                "Column7": "Federal Supplier"
            },
            {
                "Column0": "FS-100002",

    ... and so forth.

    I tested the Web Service in VBCS Service Connections and it brings back the response JSON Data above.  I created an ADP-based table that I populate with the an event that calls the web service.  The ADP is very straightforward based on type that is tied the variable that is tied to the table.  For some reason, I cannot display the data because of the uncaught type error.

    Has anyone experienced this with OTBI Reports or with any other type of web service call? 

    Thanks,

    Steve

    Version:
    19.2.3

    Best Comment

    Shay Shmeltzer

    It will be interesting to see the structure of the variable VB created for the get endpoint based on the returned structure - does it contain an array within an array?

    You might need to shape the data to fit the structure you are expecting to get - https://blogs.oracle.com/vbcs/shaping-data-using-customized-fetch-action-chains

    Comment

     

    • Shay Shmeltzer

      Just a guess, but what is the content-type header that is returned from the REST call?

       

      • Stephen Bryant

        I'm not sure if this would make a difference but the report does not have an id column so I assigned a column that did not have unique values.

      • Stephen Bryant

        Shay,

        I think the issue is VBCS does not seem to store the Rest Call response in the Array Data Provider.  What I mean is if I map the columns directly from Rest Call to the ADP, I get one row of data in the table.  However, if I map the Items[i] or Data, VBCS does not seem to treat it as an array in the call and iterate over it.  Cloud this have something to do with the JSON I defined?  I'm not sure how to structure the data so VBCS can treat it like an Array.

        This is the first time I've attempted bringing OTBI Data into VBCS.

        I can get one row but not all rows.

        Any ideas or suggestions?

        Thanks,

        Steve

        • Shay Shmeltzer

          It will be interesting to see the structure of the variable VB created for the get endpoint based on the returned structure - does it contain an array within an array?

          You might need to shape the data to fit the structure you are expecting to get - https://blogs.oracle.com/vbcs/shaping-data-using-customized-fetch-action-chains

          • Stephen Bryant

            Shay,

            Okay, I will give the re-shaping a try but cannot get to it tonight.

            I will keep you posted.

            Steve

          • Stephen Bryant

            Shay,

            I am still having problems with this.  I am using the POST method to run the OTBI report and fetch the results from SaaS so I cannot do a customized fetch.  The result that is returned from the fetch looks like this:

            {
                "items": [
                    {
                        "period": "Oct-17",
                        "concatenatedSegments": "2018.2018.0100D-101000.01-000000-0000-000000-2018-000",
                        "fund": "2018.2018.0100D",
                        "account": "101000.01",
                        "program": "000000",
                        "activity": "0000",
                        "object": "000000",
                        "bfy": "2018",
                        "org": "000",
                        "begBal": "0",
                        "drBalance": 7800000,
                        "crBalance": 0,
                        "ccid": "35393630313435333132323833313834"
                    },
                    {
                        "period": "Oct-17",
                        "concatenatedSegments": "2018.2018.0100D-310100.01-000000-0000-000000-2018-000",
                        "fund": "2018.2018.0100D",
                        "account": "310100.01",
                        "program": "000000",
                        "activity": "0000",
                        "object": "000000",
                        "bfy": "2018",
                        "org": "000",
                        "begBal": "0",
                        "drBalance": 0,
                        "crBalance": 7800000,
                        "ccid": "32363731333834323237313535393034"
                    },
                    {
                        "period": "Oct-17",

            and so on up to 438 items.

            The rest endpoint processes successfully and I can see the items in CHROME Tools.  However, I fail when attempting to assign the items to another variable or directly to the ADP.  I am attaching a screenshot below that shows the two structures.  Any help is appreciated.

            Thanks,

            Steve

             

    • Stephen Bryant

      Shay,

      It is "content-type: application/json; charset=UTF-8"

      Strange but this is the first time I've retrieved data with an OTBI report.  But data is data so I am really confused here.

      Thanks,

      Steve

    • Stephen Bryant

      Did not mean to hit Best Answer.

      Here is the shape of the data:

       

      {
          "items": [
              {
                  "id": "2d383233383438373336313533303136",
                  "Column0": "Duplicate-10002",
                  "Column1": "2019-01-05",
                  "Column2": "Invoice is missing invoice lines and needs completion.",
                  "Column3": "2019-01-09",
                  "Column4": "1",
                  "Column5": "SYSTEM",
                  "Column6": "250",
                  "Column7": "Federal Supplier"
              },
              {
                  "id": "2d363130383634313839353734363630",
                  "Column0": "FS-100002",
                  "Column1": "2018-12-09",
                  "Column2": "Invoice is missing invoice lines and needs completion.",
                  "Column3": "2018-12-13",
                  "Column4": "1",
                  "Column5": "SYSTEM",
                  "Column6": "230000",
                  "Column7": "Federal Supplier"
              },
              {
                  "id": "36313737383734373535323435343732",
                  "Column0": "FS-100002",
                  "Column1": "2018-12-09",
                  "Column2": "Total of invoice distributions does not equal invoice amount.",
                  "Column3": "2018-12-13",
                  "Column4": "1",
                  "Column5": "SYSTEM",
                  "Column6": "230000",
                  "Column7": "Federal Supplier"
              },
              {
                  "id": "2d353938383338303336303933363731",
                  "Column0": "FS-1124",
                  "Column1": "2018-11-11",
                  "Column2": "Invoice is missing invoice lines and needs completion.",
                  "Column3": "2018-11-16",
                  "Column4": "1",
                  "Column5": "SYSTEM",
                  "Column6": "300",
                  "Column7": "Federal Supplier"
              },