注意:本文中所有的代码示例都用 Web Services API 的 Rational Portfolio Manager 7.0.3.3 版本测试过了。
下面罗列出 Rational Portfolio Manager/Web Services API 配置和入门安装的必要条件。
- Rational Portfolio Manager 数据库必须在 DB2® 或 Oracle® 的支持版本上运行。
- Rational Portfolio Manager web 应用服务器必须在以下任意的支持的应用服务器版本上安装并配置:
- WebSphere® 5.1 或 6.0
- WebLogic® 8.1.5.0
- Apache Tomcat™ 5.0 或 5.5
- Oracle 9i 或 10g
- 下面与 Rational Portfolio Manager 相关的
ear文件必须在应用服务器上打开并运行。
- Rational Portfolio Manager 中间件:
IBMRPM.ear - Rational Portfolio Manager Web Services:
rpm-web-services.ear
- Rational Portfolio Manager Web Services API Client 安装必须在安装了 Rational Portfolio Manger web 应用程序的同一个应用服务器上部署。
注意:查阅本文末尾参考资源部分中罗列出的 ResourcesRational Portfolio Manager Web Services API Guide 的章节 2、3 和 4,获得安装、配置,及部署 Web Services API 的详细指导。此文档的最新版本可以从 Rational Portfolio Manager Product 的支持页上获得。要获得此文档,单击下载部分中的所有 Rational Portfolio Manager 下载,选择 IBM Rational Portfolio Manager 的最新版本,并下载适合您需求的最新的下载包。
本文向您展示了所有集成的基本步骤:
- 如何配置对应用服务器的连接
- 如何利用 Rational Portfolio Manager Web Services API 开始
注意:将此文档作为所有其他集成文档的开始参考点进行查阅。
利用 Web Services API 配置到应用服务器的连接
您必须首先创建 properties 文件,然后配置以下变量,利用 Web Services API 连接应用服务器。
-
RPM_URL -
RPM_USERNAME -
RPM_PASSWORD -
RPM_DSN
属性文件
# RPM Web Services URL
RPM_URL = http://localhost:9080/rpm/services/
# The user name which is used in RPM client
RPM_USERNAME = administrator
# The password of the user
RPM_PASSWORD = ibm
# The data source name
RPM_DSN = jdbc/RPMDATASOURCE |
Rational Portfolio Manager —— 主要方法
以下部分是利用 Web Services API 开始 Rational Portfolio Manager 集成所必需的主要方法。
- 登入 Rational Portfolio Manager
- 获得应用程序接口
- 退出 Portfolio Manager
参见下一个部分中的代码示例,了解每个方法的详细情况。
登入过程创建了包含一些信息的有效的会话 ID,Web 服务使用这些信息,通过在不必须每次重复授权的情况下使用事务来确定客户端用户。要完成这些,Web 服务在登录时为客户端用户分配了会话 ID,该会话 ID 直到客户端向 Authenticate 服务发出登出请求以终止会话之前一直有效。
以下代码示例将令您浏览每个基本步骤和主要方法的详细情况。
代码示例
package samples;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.xml.rpc.ServiceException;
import com.ibm.rpm.framework.RPMException;
import com.ibm.rpm.interfaces.Application;
import com.ibm.rpm.interfaces.ApplicationServiceLocator;
import com.ibm.rpm.interfaces.Authenticate;
import com.ibm.rpm.interfaces.AuthenticateServiceLocator;
public class IntegrationCommonFunctionality
{
/**
* application interface
*/
private static Application applicationInterface = null;
/**
* url of the application service
*/
private static String urlApplication;
/**
* application service locator
*/
private static ApplicationServiceLocator appServiceLocator
= new ApplicationServiceLocator();
/**
* authenticate interface
*/
private static Authenticate authenticate = null;
/**
* url of the authenticate service
*/
private static String urlAuthenticate;
/**
* authenticate service locator
*/
private static AuthenticateServiceLocator authServiceLocator
= new AuthenticateServiceLocator();
/**
* The user name which is used in RPM client.
*/
private static String userName;
/**
* The password of the user.
*/
private static String password;
/**
* The data source name.
*/
private static String dsn;
/**
* Set the variables using the configuration property file.
*/
static
{
// Open the property file
// if the file is not,found, exceptions are thrown
Properties properties = new Properties();
try
{
properties.load(new FileInputStream(".\\src\\samples\\config.property"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
// Set the variables using the property file
urlApplication = properties.getProperty("RPM_URL") + "Application";
urlAuthenticate = properties.getProperty("RPM_URL") + "Authenticate";
userName = properties.getProperty("RPM_USERNAME");
password = properties.getProperty("RPM_PASSWORD");
dsn = properties.getProperty("RPM_DSN");
}
/**
* Log into RPM server
*
* @return Session ID which will be used during the integration.
* @throws MalformedURLException
* @throws ServiceException
* @throws RPMException
* @throws RemoteException
*/
public static String login() throws MalformedURLException,
ServiceException, RPMException, RemoteException
{
String sessionID = null;
// get Authenticate service interface
authenticate = authServiceLocator.getAuthenticate(new URL(
urlAuthenticate));
// login to RPM server
sessionID = authenticate.login(userName, password, dsn);
return sessionID;
}
/**
* Log out from RPM server.
*
* @param sessionID
* @throws RPMException
* @throws RemoteException
*/
public static void logout(String sessionID) throws RPMException,
RemoteException
{
authenticate.logout(sessionID);
}
/**
* Get ApplicationInterface for further operations.
* @return ApplicationInterface
* @throws MalformedURLException
* @throws ServiceException
*/
public static Application getApplicationInterface()
throws MalformedURLException, ServiceException
{
if (applicationInterface == null)
{
applicationInterface = appServiceLocator.getApplication(new URL(
urlApplication));
}
return applicationInterface;
}
} |
| 描述 | 名字 | 大小 | 下载方法 |
|---|---|---|---|
| PDF file of reference | i1167610.pdf | 13,001KB | HTTP |
学习
- 您可以参阅本文在 developerWorks 全球网站上的 英文原文。
- 参阅 Rational Portfolio Manager Web Services API guide,了解关于安装、配置,及部署 Web Services API 的详细指导。
- “使用 XML-RPC 为 C++ 应用程序启用 Web 服务”(developerWorks,2006 年 9 月)是将 C++ 方法做成服务的逐步指导。
- 阅读 Michael F. Hanford 的 Rational Portfolio Manager 介绍性文章,项目组合管理入门,及 项目组合管理(Portfolio management):IBM Rational 新方法概述。
- 要了解更多关于 IBM Rational Portfolio Manager 的信息,请访问 developerWorks 上的 Rational Portfolio Manager 产品资源页。
- 在 developerWorks 中国网站架构专区中,获得您提高架构方面的技能所需的参考资料。
- 浏览技术书店,获得关于这些和其他技术主题的书籍。
-
SOAP 规范
-
WSDL 规范
-
XML 规范
-
XPath:XML Path Language
-
使用 Apache Axis 进行 Java Web 服务开发
获得产品和技术
- 熟悉 IBM Rational Portfolio Manager 产品,包括特性、系统需求,并获得 IBM Rational Portfolio Manager 产品页上的信息。
讨论
- 参与论坛讨论。
- 访问 developerWorks Rational 上的 Rational Portfolio Manager 论坛。
- 在 Rational 全球用户组社区 查找您所在区域的用户组。Rational 用户组是独立的,由用户运行的组织,它提供促进客户和 Rational 职员之间信息交换的开放论坛。