Using remote web services API

You can use IBM® Rational® Asset Manager web services in your applications.

About this task

Attention: The web services API and the HTTP upload and download mechanism are internal API and not supported. Use at your own risk.

Rational Asset Manager publishes web services that allow you to work with the repository. Use the Rational Asset Manager Web Services Descriptor Language (WSDL) file to develop custom applications that interact with the Rational Asset Manager server.

Procedure

To connect to Rational Asset Manager server using the web services:

  1. Navigate to the Extensions page in the Rational Asset Manager web client.
  2. Under Web Services, click the RAM1.wsdl link to download the WSDL file.
  3. In order to use the web service, you must generate the client side proxies from the WSDL to interact with the server.
  4. Once the proxies are generated for the WSDL, access the following web services URL: http://server:port/com.ibm.ram.repository.web.ws.was/RAMServices, where server is the host name of the server, port is the port number, com.ibm.ram.repository.web.ws.was is the web services web application and RAMServices is the location where the web service is available. The client should enable redirecting when making the call, as RAMServices redirects to the call the appropriate location automatically.

    Clients can access http://server:port/com.ibm.ram.repository.web.ws.was/RAMServices to get the services. This single location for invoking web services will redirect the client to either the anonymous server location at http://server:port/com.ibm.ram.repository.web.ws.was/services/RAM1 or to the basic authentication location at http://server:port/com.ibm.ram.repository.web.ws.was/RAMSecure/services/RAM1, depending on the presence of user credentials in the request.

    If clients prefer to directly access the anonymous and basic authentication based services, they can do so by using the http://server:port/com.ibm.ram.repository.web.ws.was/services/RAM1 and http://server:port/com.ibm.ram.repository.web.ws.was/RAMSecure/services/RAM1 endpoints, respectively.

  5. Connect to the server:
    • If you want to connect as a signed in user, provide the user name and password using HTTP basic authentication.
    • If you want to connect anonymously, do not provide a user name and password.
  6. Rational Asset Manager has a licensing schema that gives a license for each user who connects to the server. If you make multiple calls and want to keep the same license cache the connection to the server and your sessions will maintain the same license.
  7. Use the API found in the Rational Asset Manager Javadoc, which is in the Reference section of the help.

Results

Remember: To connect using a HTTPS SSL secure connection, confirm that the public key off the server is located in the keyring of the client for the HTTPS to work.

Example

An example class for invoking web services:
public class RAMClient {
  public static final String RAM_LOCATION = "http://server:port/com.ibm.ram.repository.web.ws.was";

  public void doSearchAndDownload() throws Exception {
    String SECURE_PREFIX = "/RAMSecure"; // To be used when username and password are provided
    String RAM_WS_LOCATION = RAM_LOCATION + SECURE_PREFIX + "/services/RAM1";
    String USERNAME = "admin";
    String PASSWORD = "admin";

    // Construct WebSerivces stub
    RAM1 ramWebService = new RAM1ServiceLocator().getRAM1(new URL(RAM_WS_LOCATION));
    if (ramWebService instanceof Stub) {
      Stub axisStub = (Stub) ramWebService;
      // Set user name and password
      axisStub.setUsername(USERNAME);
      axisStub.setPassword(PASSWORD);
    }

    // Get constants for invoking WebServices
    Constants constants = ramWebService.getConstants();

    // Search for assets with name starting with 'soa' and owned by 'admin' user.
    String[] queries = new String[2];
    queries[0] = constants.getQUERY_NAME()+":(soa*)";
    queries[1] = constants.getQUERY_OWNER()+":(admin)";
    SearchResultSO searchResults = ramWebService.search(queries, null, true, 
      constants.getSORT_LAST_MODIFIED(), 0, -1, -1, false, Locale.getDefault().toString());

    // Download assets got from search
    String RAM_ASSET_LOCATION = RAM_LOCATION + SECURE_PREFIX + "/RAMAssetAccess.jsp?";
    SearchAssetInformationSO[] searchAssets = searchResults.getSearchAssets();
    for (int ac = 0; ac < searchAssets.length; ac++) {
      String assetID = searchAssets[ac].getGUID();
      String assetVersion = searchAssets[ac].getVersion();

      String encodedAssetID = URLEncoder.encode(assetID, "UTF-8");
      String encodedAssetVersion = URLEncoder.encode(assetVersion, "UTF-8");

      String assetLocation = RAM_ASSET_LOCATION + "assetid="+encodedAssetID+"&version="+encodedAssetVersion;
      downloadAssetUsingHTTPGet(assetLocation, USERNAME, PASSWORD);
    }
  }

  private void downloadAssetUsingHTTPGet(String assetLocation, String username, String password) {
    // Download asset
  }
}

Feedback