IBM®
跳转到主要内容
    中国 [选择]    使用条款
 
 
Select a scope: Search for:    
    首页    产品    服务与解决方案     支持与下载    个性化服务    
跳转到主要内容

developerWorks 中国  >  Rational | SOA and Web services  >

Rational Portfolio Manager 7.1.0.0 入门:使用 Web Services API 集成

developerWorks
文档选项

未显示需要 JavaScript 的文档选项

讨论


级别: 中级

Cobber Liu (cobberliu@ca.ibm.com), 开发人员, IBM

2007 年 9 月 26 日

本文是介绍如何利用 Web Services API 在 IBM® Rational® Portfolio Manager 中集成数据的系列文章的开篇。IBM Rational Portfolio Manager 是将您所有的跨整个企业的项目、人和优先权都自动化的企业级项目组合管理解决方案。通过这些文章及它们所提供的代码示例,您将逐步了解如何完成集成,以便您可以构建您自己的特有的集成接口。

必备条件

注意:本文中所有的代码示例都用 Web Services API 的 Rational Portfolio Manager 7.0.3.3 版本测试过了。

下面罗列出 Rational Portfolio Manager/Web Services API 配置和入门安装的必要条件。

  1. Rational Portfolio Manager 数据库必须在 DB2® 或 Oracle® 的支持版本上运行。
  2. Rational Portfolio Manager web 应用服务器必须在以下任意的支持的应用服务器版本上安装并配置:
  • WebSphere® 5.1 或 6.0
  • WebLogic® 8.1.5.0
  • Apache Tomcat™ 5.0 或 5.5
  • Oracle 9i 或 10g
  1. 下面与 Rational Portfolio Manager 相关的 ear 文件必须在应用服务器上打开并运行。
  • Rational Portfolio Manager 中间件:IBMRPM.ear
  • Rational Portfolio Manager Web Services:rpm-web-services.ear
  1. 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 的最新版本,并下载适合您需求的最新的下载包





回页首


引言

本文向您展示了所有集成的基本步骤:

  1. 如何配置对应用服务器的连接
  2. 如何利用 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 referencei1167610.pdf13,001KBHTTP
关于下载方法的信息Get Adobe® Reader®


参考资料

学习

获得产品和技术

讨论


关于作者

>Cobber Liu 目前是 Concordia 大学计算机科学的在职研究生,他攻读软件工程硕士。他作为合作学生在 20006 年 1 月加入 IBM RPM Web Services 团队,同时完成了计算机科学学士学位。他最近作为开发人员加入 RPM Web Services API 团队,并从事 Rational Portfolio Manager 7.1.0.0 发布。




对本文的评价










回页首


IBM 公司保留在 developerWorks 网站上发表的内容的著作权。未经IBM公司或原始作者的书面明确许可,请勿转载。如果您希望转载,请通过 提交转载请求表单 联系我们的编辑团队。
    关于 IBM 隐私条约 联系 IBM 使用条款