Open Services for Lifecycle Collaboration (OSLC) represents a set of standards or rules for how software development tools provide their services and share their data with other tools.
If a software development tool provides a service through an OSLC interface, it is called an OSLC provider. A tool that provides an interface to use the services is called a consumer. The OSLC specifications define the rules for how an OSLC provider and a consumer should behave. One of these specifications is about pre-filling creation dialogs windows.
As an example, IBM® Rational® Change 5.3 behaves as an OSLC provider by providing many services. One such service is creating change requests through an OSLC interface. IBM® Rational® Quality Manager 3.0 might use or consume this service by relating the change request to a test case.
To integrate any software development tools in the OSLC mode, a tool that is a provider must register with the consumer so that the two tools can complete an exchange, and the same applies in reverse. In this example, Rational Quality Manager registers Rational Change as an OSLC service provider and Rational Change approves the registration. After the OSLC integration is established between the tools, the OSLC consumer can use the services from the provider. Therefore, now Rational Quality Manager can create and consume change requests in Rational Change and associate them with any of its test cases. To create or choose an existing change request, Rational Change has to provide a dialog through which the consumers can create or select the required resource. (This is another specification in OSLC called Delegated UI, where the provider must provide an interface for users to create and select resources.
Every time that the consumer creates a change request through its provider, the consumer needs to fill in all of the fields in the provider’s resource creation interface. Some developers might want some provider fields be pre-filled in the creation dialog so that do not need to enter the value every time or so they can add more to an existing value. The OSLC core specification defines this behavior of pre-filling the creation dialogs for providers. Rational Change implements this specification by allowing you to pre-fill the change request creation dialogs.
An example of how to pre-fill a creation dialog
To pre-fill a creation dialog, the OSLC consumer needs to send the pre-filling data in a POST request to the URI of the provider’s creation dialog. The provider must respond with a status of 201 (Created), with the Location response header and a value that is the URI to request the newly created form.
Service providers might not store the created form. Therefore, a GET method on these transient response URIs might result later, with response status codes of 404 (Not found) or 3xx (Redirect).
The code snippet that follows sends a POST request to the Rational Change creation dialog to pre-fill the dialog’s Summary attribute. After the response is received from the provider, the code prints the location for the actual pre-filled creation dialog.
Sample code to pre-fill a creation dialog in Rational Change
//import the required classes to create POST request
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
/**
* This class will POST a request to OSLC provider’s creation dialog to pre-fill
* the dialog and from the embedded response, it prints the location for the actual
* pre-filled creation dialog.
*/
public class PostToPreFillDialog
{
/**
* Pre-filling the Summary attribute in the creation dialog
*/
public static void postData(String url)
{
PostMethod post = new PostMethod(url);
try {
post.setRequestHeader("Content-Type", "application/x-oslc-cm-change-request+xml");
//create the data needs to be sent to the creation dialog. It should be in the
//format set above in the "Content-Type". Include the attribute names and values
//to be prefilled. I have added the ‘Summary’ attribute and its value.
String data = "<oslc_cm:ChangeRequest xmlns:dcterms='http://purl.org/dc/terms/'
xmlns:foaf='http://xmlns.com/foaf/0.1/'
xmlns:oslc='http://open-services.net/ns/core#'
xmlns:oslc_cm='http://open-services.net/xmlns/cm/1.0/'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<Summary>This is my synopsis!</Summary>
</oslc_cm:ChangeRequest>";
StringRequestEntity requestEntity = new StringRequestEntity(data);
post.setRequestEntity(requestEntity);
//set the user login credentials in the request
//header. Rational Change expects it to be set in a specific cookie.
//This information can be got from the browser’s cookie.
post.setRequestHeader("Cookie", "JSESSIONID=16rzss8fdtk3b;
ChangeLoginCookie_8080_context=
user1%7c%5c%5myserver%5database%5testdb%7ccentral%7c
User%7ctrue");
//send the post request
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(post);
//The response header has the location for the pre-filled dialog,
System.out.print(post.getResponseHeader("Location"));
}
catch (HttpException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }
finally { post.releaseConnection(); }
}
public static void main(String args[])
{
try
{
//call the postData method with the URL to the creation dialog.
//The creation dialog URL can ge got from the provider’s OSLC service catalog.
postData
("http://Myserver:8080/context/oslc/db/<database_guid>/role/User/dialog/
START_HERE2entered");
}
catch (Exception e) { e.printStackTrace(); }
}
} |
| Description | Name | Size | Download method |
|---|---|---|---|
| Sample code | pre-fill-creation-dialog-rational-change.zip | 2KB | HTTP |
Information about download methods
Learn
- Review the OSLC core specification and the OSLC Change Management specification.
- Start at the Rational Change page on developerWorks to learn about features and benefits, get product details and information on related Rational products, and to find more technical articles and where to get support.
- Check the Rational Quality Manager page on IBM® developerWorks® for links to product documentation, articles, tutorials, courses, downloads, and other useful areas. Also, explore the Rational Quality Manager Information Center for technical details and browse the IBM Quality Management page to learn more about what is available.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Subscribe to the developerWorks weekly email newsletter, and choose the topics to follow.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Attend a free developerWorks Live! briefing to get up-to-speed quickly on IBM products and tools, as well as IT industry trends.
- Watch developerWorks on-demand demos, ranging from product installation and setup demos for beginners to advanced functionality for experienced developers.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, any time, and many of the "Getting Started" ones are free.
Get products and technologies
- Download the free trial version of Rational Quality Manager.
- Get the free Trial Download or check the Trials and Demos page for other Rational software.
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
Discuss
- Join the Enterprise Change Management with Rational Change forum to ask questions and participate in discussions.
- Join the Rational Quality Manager forum, which also includes discussions about Rational Test Lab Manager.
- Rate or review Rational software. It’s quick and easy.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. Find out what makes a good developerWorks article and how to proceed.
- Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Get social about thought leadership. Join the Rational community to share your Rational software expertise and get connected with your peers.

Neeraja Vishwanathapura, a senior software engineer, has nearly nine years of experience in software development and has been working as a senior developer for IBM Rational Change software for the past five years. She has experience in Java, Java 2 Enterprise Edition (J2EE), Perl, web technologies such as Dojo toolkit, Ajax, web services, OSLC, and change and configuration management.



