Menu

Integrating Oracle Digital Assistant with Oracle Analytics Cloud via SOAP webservice

Chatbots, OracleMobile By Nov 03, 2020 No Comments

In this post, you will see the integration between ODA (Oracle Digital Assistant) and OAC(Oracle Analytics Cloud) dashboard.

Creating OAC dashboard:

  • For the integration, we created a sample OAC dashboard as shown in the below screenshot
  • Soap services are exposed for the dashboard

Changes required to the ODA custom component:


var soap = require('soap');
var url = 'https://XXXX-XXXXXXXX-ld.analytics.ocp.oraclecloud.com/analytics-ws/saw.dll/wsdl/v12';
var args = {
    name: 'username@oracle.com',
    password: "password"
};

soap.createClient(url, function(err, client) {
    client.logon(args, function(err, result) {
        var sid = result.sessionID.$value;
        console.log(sid);
        rPath = "/shared/COVID19NL/Covid19NL";
        var xmlQueryArgs = {
            report: {
                reportPath: rPath
            },
            outputFormat: "",
            executionOptions: {
                async: '',
                maxRowsPerPage: '',
                refresh: '',
                presentationInfo: '',
                type: ''
            },
            sessionID: sid,
            reportParams: {
                variables: [{
                    "name": "varCity",
                    "value": "Amsterdam"
                }, {
                    "name": "varMonth",
                    "value": "Apr"
                }]
            }
        };

        var xmlResult = "";
        var transition = "success";
        var filteredRows = [];

        client.executeXMLQuery(xmlQueryArgs, function(err, result) {
            if (err) {
                transition = "fail";
                console.log(err.body);
                conversation.reply(err).transition(transition);
                done();
                return;
            }

            xmlResult = result.return.rowset.$value;
            var convert = require('xml-js');
            var options = {
                compact: true,
                ignoreComment: true,
                spaces: 4
            };
            var resp = convert.xml2json(xmlResult, options);
            var rows = JSON.parse(resp).rowset.Row;

            if (rows && rows.length > 0) {
                filteredRows = rows;
                transition = "success";
                console.log(filteredRows);
            } else {
                transition = "none";
            }

            conversation.transition(transition);
            conversation.variable('resultRows', filteredRows);
            done();
        });

    });
});

No Comments

Leave a comment

Hi, Welcome here.
JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.