跳过导航链接
此文档说明如何通过WebService方式调用Smartbi API
  Smartbi WebService提供:CatalogService、SimpleReportService、ManageReportService、AnalysisReportService以及UserManagerSerive五项服务接口。

请参阅: 说明

程序包 
程序包 说明
smartbi.catalogtree
资源树功能包,提供资源树相关操作功能。
smartbi.freequery.client.businessview
数据集查询功能包,提供数据集相关操作功能。
smartbi.freequery.client.datasource
数据源管理功能包,提供数据源相关操作功能。
smartbi.olap.webservice
多维分析功能包,提供多维分析相关操作功能。
smartbi.usermanager
用户管理功能包,提供用户管理相关操作功能。
此文档说明如何通过WebService方式调用Smartbi API
  Smartbi WebService提供:CatalogService、SimpleReportService、ManageReportService、AnalysisReportService以及UserManagerSerive五项服务接口。
  1. CatalogService: 提供资源目录树的访问功能等。
  2. SimpleReportService: 提供灵活报表相关操作功能。
  3. ManageReportService: 提供业务类报表相关操作功能。
  4. AnalysisReportService: 提供多维分析相关操作功能。
  5. UserManagerService:提供用户相关操作,包括:读取/维护用户信息、读取/维护组信息、读取/维护角色信息、为用户和组分配角色等。
  6. DataSourceService: 提供数据源相关操作功能。

  实现步骤:
  1、假设Smartbi服务器已经部署到应用服务器中,访问地址为:http://biserver:port/smartbi/vision 
  2、从Smartbi帮助插件包SmartbiHelp.ext中(或参见本文底部附件help_sdk_WebService.rar)把目录SmartbiHelp.ext\vision\help\sdk\WebService\下的run.cmd和config.xml拷贝至本地目录如D:\WebService\下。
  3、编辑D:\WebService\run.cmd,修改其中 Smartbi 服务器地址为实际地址。

  Rem 生成CatalogService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.Catalog /par:config.xml
  http://localhost:18080/smartbi/vision/services/CatalogService?wsdl

  Rem 生成UserManagerService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.User /par:config.xml
  http://localhost:18080/smartbi/vision/services/UserManagerService?wsdl

  Rem 生成SimpleReportService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.SimpleReport /par:config.xml
  http://localhost:18080/smartbi/vision/services/SimpleReportService?wsdl

  Rem 生成ManageReportService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.ManageReport /par:config.xml
  http://localhost:18080/smartbi/vision/services/ManageReportService?wsdl

  Rem 生成AnalysisReportService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.AnalysisReport /par:config.xml
  http://localhost:18080/smartbi/vision/services/AnalysisReportService?wsdl

  Rem 生成BusinessViewService的cs文件
  wsdl /protocol:SOAP12 /n:Smartbi.BusinessView /par:config.xml
  http://localhost:18080/smartbi/vision/services/BusinessViewService?wsdl

  4、生成各服务接口的cs文件:以Microsoft Visual Studio 2005版本为例,点击"开始 > 所有程序 > Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 命令提示",运行D:\WebService\run.cmd
  5、在您的.net项目环境中,选择项目名称下的引用,右键添加引用
  6、在“添加引用”窗口,选择“.net”选项卡下的“System.Web.Services”,点击“确定”按钮即可
  7、在您的 .net 项目环境中,新建一个文件夹如WebService,右键选择"添加 -> 现有项"。然后在“添加现有项”窗口中,选择第 (3) 步中D:\WebService下生成的 *Service.cs文件,点击“添加”即可
  8、完成以上几个步骤就可以调用 Smartbi 的 API 函数了。

  使用步骤:
  1.创建服务对象。目前提供了五个服务对象,创建方式如下:
   CookieContainer cookieContainer = new System.Net.CookieContainer();
   //用户管理服务对象
   UserManagerService user = new UserManagerService();
   user.CookieContainer = cookieContainer;
   //登录Smartbi
   user.login("admin", "manager");
   //资源目录树服务对象
   CatalogService catalog = new UserManagerService();
   catalog.CookieContainer = cookieContainer;
   //灵活分析服务对象
   SimpleReportService simpleReport = new SimpleReportService();
   simpleReport.CookieContainer = cookieContainer;
   //业务类报表
   ManageReportService manageReport = new ManageReportService();
   manageReport.CookieContainer = cookieContainer;
   //多维分析报表
   AnalysisReportService analysisReport = new AnalysisReportService();
   analysisReport.CookieContainer = cookieContainer;
   //数据源服务对象
   DataSourceService datasource = new DataSourceService();
   datasource.CookieContainer = cookieContainer;

  2.使用服务对象。需要注意的是,必须先执行登录方法才能正常使用服务对象,具体的方法说明参看相应的API文档。
  3.注销。当调用完所有方法后,建议调用注销方法注销Smartbi。


  调用服务接口请参考示例,更多信息请参见 WebService接口.NET示例
跳过导航链接