OBIEE Web services with javascript

OBIEE web services provide a large set of operations on ibots, jobs, metadata, analysis, webcat...
http://docs.oracle.com/cd/E21764_01/bi.1111/e16364/soa_overview.htm
http://docs.oracle.com/cd/E23943_01/bi.1111/e16364/methods.htm

A wsdl is provided for these services, and it is common to call them in a process running in Weblogic server (java custom application).  However, it is also possible to call them using javascript in a browser, or in a server with a javascript engine (Nodejs.org, or else).
The main limitation for the browser resides in the cross domain calls being blocked for security reasons. In this case, the javascript code has to be deployed in a webapp in the same domain as obiee (like http://obieeserver:port/yourwebapprootcontext)

It is rather practicle for tests purposes to use a javascript obiee web service client.

To create the javascript client from the obiee wsdl, use Apache CXF wsdl2js utility. http://cxf.apache.org/docs/wsdl-to-javascript.html

  • For BI Publisher:

Services available here: http://server:port/xmlpserver/services
For example you can use this wsdl for the scheduler: http://server:port/xmlpserver/services/v2/ScheduleService?wsdl

In a shell:
set PATH=C:\apache-cxf-2.7.7\bin;C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\bin;%PATH%
set JAVA_HOME=C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk

cd /d c:\mywsdltojsfiles

wsdl2js -p soap http://server:port/xmlpserver/services/v2/ScheduleService?wsdl

This creates this file:
ScheduleService.js


  • For Obiee soap web services:

Create the js files using wsdl2js and http://server:port/analytics/saw.dll?privateWSDL
Operations are described here: http://docs.oracle.com/cd/E21764_01/bi.1111/e16364/methods.htm

This generates these files:
SAWSessionService.js for getting a sessionid
the other services: WebCatalogService.js, IBotService.js and so on

  • For obiee bisecurity web service: this is using ws-security for login, and this requires a change in generated js files for the login to work (this requires a specific soap header). Not covered in this blog since bisecurity web service is not supported as a client api for use by customers/partners.

Then you can call the generated functions this way (example with obiee soap web service):

  • Make sure you include the generated js, as well as cxf-utils.js
  • Create a new js:

// Get a sessionid
     var loginPort=new SAWSOAP_SAWSessionServiceSoap();
     if (url) loginPort.url=url+"?SoapImpl=nQSessionService";
     var sessionID="";
     loginPort.logon(
        function (responseObject) {
            console.log("Call succeeded -> Sessionid:"+responseObject.getSessionID());     
            sessionID=responseObject.getSessionID();
        },errorCallback,user,pass);
     console.log("Done sessionid:"+sessionID);

// call ibot service to send message through default delivery channels
     var ibotPort=new SAWSOAP_IBotServiceSoap();
     if (url) ibotPort.url=url+"?SoapImpl=ibotService";

     var message="This is my message";
     var groupArray=[];
     groupArray.push(recipient);

    ibotPort.sendMessage(successCallbackSendMessage, errorCallback, '',groupArray, 'OBIEE IBOT message',message,'Normal', sessionID );

With the call backs for the async calls:

function errorCallback(httpStatus, httpStatusText)
{
    globalErrorStatus = httpStatus;
    globalStatusText = httpStatusText;

    console.log("Error:"+httpStatusText+" "+httpStatus);
}
function successCallbackSendMessage(responseObject)
{
 console.log("Call succeeded: message sent");
}


Example with getting the most recent used items through the web service:


function getMostRecentUserItemsLists(loginPort,sessionID) {
     loginPort.getUserLists(successCallbackUserItemsLists, errorCallback, sessionID);
     console.log("Done users list");    
}

 

function successCallbackUserItemsLists(responseObject)
{
  console.log("Call succeeded: userlists:"+responseObject.getReturn());
  var i=0;
  var mruList;

  mruList=responseObject.getReturn().getMruList();

  // display last mru

  if (mruList.length>0) {
   var recentItem=mruList[0];
    var path=recentItem.getPath();
    var sig=recentItem.getSignature();
    console.log("mrulist length:"+mruList.length);
    if (mruList.length>1) {
            recentItem=mruList[1];
            path=recentItem.getPath();
            sig=recentItem.getSignature();
    }

    console.log(path);
    console.log(sig);
  }
}

 

 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

A blog focused on Tips & Tricks about Oracle Business Intelligence (OBI), Oracle Exalytics and Oracle Enterprise Performance Management (EPM) products.
[Blog Admin: ahmed awan]

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today