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:
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
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
}
}