From many days I was thinking to blog on Web Services using .net, today I could able to make it.
If you want to see what are all available web services in Bi Server then just browse this url in any browser http:///analytics/saw.dll?WSDL you will be able to see all available services.
Here is a very basic code (kind of hello world) in C# which will logon user to BI server and get the report results.
To do that, go to report's advanced tab collect Request XML, then create project in visual studio and web reference to project as show in fig.
From O.B.I.E.E |
As per our requirement we need following class objects to achieve our task
SAWSessionService, ReportRef, XmlViewService.
Here is code which will authenticate user and gets report results as xml string.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using saw = Obiee_Services.web_Reference;
using System.IO;
using System.Data;
namespace Obiee_Services
{
class HelloWorld
{
static void Main(string[] args)
{
var sawservice = new saw.SAWSessionService();
//Give user credentials who has soap access.
var sessionID = sawservice.logon("Administrator", "");
var repRef = new saw.ReportRef();
//Pass report name along path and Request XML to ReportRef object
repRef.reportPath = @"/users/administrator/#cachehitsbyusers";
repRef.reportXml = " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"xmlVersion=\"200705140\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"xmlns:sawx=\"com.siebel.analytics.web/expression/v1\">\" \" columnID=\"c1\"/> formula=\"SUM(S_NQ_ACCT.NUM_CACHE_HITS)\"columnID=\"c4\"/>";
var xmlViewService =new saw.XmlViewService();
var xMLQueryExecutionOptions = new saw.XMLQueryExecutionOptions();
xMLQueryExecutionOptions.maxRowsPerPage=100;
xMLQueryExecutionOptions.refresh = true;
//Pass report parameters if you have
var reportParams = new saw.ReportParams();
//Execute XML Query
var queryResults = xmlViewService.executeXMLQuery(repRef, saw.XMLQueryOutputFormat.SAWRowsetSchemaAndData, xMLQueryExecutionOptions,reportParams, sessionID);
//Output as you required
System.console.write(queryResults.RowSet);
sawservice.logoff(sessionID);
}
}
}
There are around 10 main classes and each has its own functionality.
"HtmlViewService" to embed Oracle BI HTML results into ASP or JSP or Web Portals
"IBotService" to execute Oracle iBots programmatically
"JobManagementService" to manage all jobs related things
"MetadataService" to retrieve description of columns, tables, and subject areas etc
"ReplicationService" to provide methods for replicating catalog
"ReportEditingService"to merges arguments with services data as users needed
"SAWSessionService" provides authentication related stuff
"SecurityService" to identifying accounts and there privileges
"WebCatalogService" for navigating and managing the Presentation Catalog
"XmlViewService" retrieve results from BI Web Services in XML format
http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/b31769.pdf this pdf covers all available class and respective methods exposed to end users.
--Hope you have enjoyed.
ExcellentVery good topic i didn't find this topic any where to implement.Thank you.For some reports it is working.But for some reports it is showing error "Error in deserializing body of reply message".I changed xmlView Service readerquotes and buffered size.please tell me the solution.
ReplyDelete@Subrahmanya
ReplyDeleteThank you for your comment.
I have not come across this issue any time, I'm just guessing as we are calling web services some times data type conversions won't happen properly, for that better to mention culture before calling web services
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Try to checking each and every datatype's and corresponding returning types from results.
Hope this helped you, let me know is it worked or not.
Thanks,
Srinivas Malyala
Hi srinivas,
ReplyDeleteThank you for your good articles.I am very new to OBIEE.I am following your blog for using Obiee Webservice from DotNet.A small doubt regarding the new query submission from webservice.If I want to submit the query as newone from Webservice i have set the
property xMLQueryExecutionOptions.refresh to true;.Is it sufficient?.Actually it is returning QueryResults with empty rowset when i set the above property.Shall I need to set another property with the above one?.
Thanks in advance,
Narayana
Hi Srinivas,
ReplyDeleteI completely followed your blog to consume OBIEE Web services in .Net.It is working fine.Thank you Very much.
A small problem raised when user tried to login using a wrong user or password.It is also returning the sessionId.But this session is not working for execution of queries or accessing reports.So that user is unable to track the actual error.Is there any method in Web service to find whether this particular user has account in OBIEE or not ?
Or Am I missing any thing?
The following is the code I used.
objSawSession= new SAWSessionService("WsdlUrl")
string SessionBI=objSawSession.logon("aa","aa");
There is no user in OBIEE with name aa.But when I used webservice from .Net I am able to get the sessionId .
Thanks,
Subbu
Hello Srinivas,
ReplyDeleteI have a query regarding this post, for light query taking less execution time the method xmlViewService.executeXMLQuery or xmlViewService.executeSQLQuery works fine. However for queries taking around 10min a web exception is thrown out saying "Operation Time OUT". What will be the root cause for such exception ? Can you provide some hint here i should move ahead ?
Regards,
Rajen
our OBIEE is deployed under SSO solution. When I try to logon, it give a "Page has moved error". Anyway to workaround this issue?
ReplyDelete