Top Banner
Get to know Open Services for Lifecycle Collaboration Change Management How to use OSLC delegated Web dialogs Skill Level: Intermediate Steve Speicher ([email protected] ) Senior Software Engineer IBM Sam Padgett ([email protected]) Advisory Software Engineer IBM 25 Feb 2010 This article highlights some of the key features of the new OSLC Change Management 1.0 specification (OSLC-CM), which is part of the OSLC group of specifications. The authors use a simple HTML + Javascript interface to illustrate how you can take advantage of these features quickly and easily. Introduction A growing community focused on Application Lifecycle Management (ALM) interoperability is forming at Open-Services.net. This initiative, referred to as the Open Services for Lifecycle Collaboration (OSLC), brings together community members to define interoperability specifications that are based on key scenarios. The initial working group focused on change management integration scenarios. These specifications provide the guidance needed for service providers (the ALM tools that receive the requests) to be invoked by a variety of consumers (the ALM tools that generate the requests). IBM® Rational® software provides many service provider implementations in products such as IBM® Rational® Team Concert™, IBM® Rational® ClearQuest®, Get to know Open Services for Lifecycle Collaboration Change Management © Copyright IBM Corporation 2010. All rights reserved. Page 1 of 22
22

Get to know Open Services for Lifecycle Collaboration

Feb 13, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Get to know Open Services for Lifecycle Collaboration

Get to know Open Services for LifecycleCollaboration Change ManagementHow to use OSLC delegated Web dialogs

Skill Level: Intermediate

Steve Speicher ([email protected] )Senior Software EngineerIBM

Sam Padgett ([email protected])Advisory Software EngineerIBM

25 Feb 2010

This article highlights some of the key features of the new OSLC ChangeManagement 1.0 specification (OSLC-CM), which is part of the OSLC group ofspecifications. The authors use a simple HTML + Javascript interface to illustrate howyou can take advantage of these features quickly and easily.

Introduction

A growing community focused on Application Lifecycle Management (ALM)interoperability is forming at Open-Services.net. This initiative, referred to as theOpen Services for Lifecycle Collaboration (OSLC), brings together communitymembers to define interoperability specifications that are based on key scenarios.The initial working group focused on change management integration scenarios.These specifications provide the guidance needed for service providers (the ALMtools that receive the requests) to be invoked by a variety of consumers (the ALMtools that generate the requests).

IBM® Rational® software provides many service provider implementations inproducts such as IBM® Rational® Team Concert™, IBM® Rational® ClearQuest®,

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 1 of 22

Page 2: Get to know Open Services for Lifecycle Collaboration

IBM® Rational® Change, and IBM® Rational® Change Management Express. Also,there are quite a few IBM products that use these services, such as IBM® Rational®Quality Manager, IBM® Rational® Requirements Composer, and IBM® Rational®Asset Manager.

What this article covers

In this article, we use a sample application that is available in the Download sectionto illustrate how you can leverage several aspects of the OSLC ChangeManagement (OSLC-CM) Version 1.0 specification:

• Service discovery

• Delegated resource creation

• Delegated resource selection

• Presentation of resources – HTML

We cover many key areas of the specifications here, although there is much more toexplore. In particular, the variety authentication models and technology choices forleveraging these services deserve your attention.

This article does not cover these specification items:

• Query

• Resource (defect, bug) property retrieval

• Resource creation and modification

Nonetheless, this article gives you with a good starting point for taking advantage ofthese services quickly, with minimal effort.

Sample application setup

This article features a sample OSLC Change Management consumer that is writtenentirely in Javascript, using the Dojo Javascript Toolkit. The sample helps readersconnect to an OSLC Change Management provider and create or find changerequests.

Server proxies in Jazz-based softwareThe same-origin policy in browsers can pose problems whenbuilding real-world integrations between Web applications. Theserestrictions protect users from a host of cross-site scripting exploits,but Web applications from different domains often legitimately needto communicate. The OSLC-CM specifications offer a solution for

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 2 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 3: Get to know Open Services for Lifecycle Collaboration

delegated Web UIs, which is discussed in the IFrameCommunication section here. Web developers who need to performservice discovery tasks still need to wrestle with this problem,however.

IBM® Jazz™ technology-based products, such as Rational TeamConcert and Rational Quality Manager, solve this problem by usingserver proxies. Requests flow through the origin server but areforwarded to the CM-provider server. See "Interacting with RemoteData" on Jazz.net for more details (see Resources).

In this sample, the Javascript client connects directly with the OSLC-CM provider.Browsers typically restrict Javascript HTTP requests to the source domain of thedocument. This is known as the same-origin policy (see sidebar). Therefore, to runthe sample, you must work around this issue in one of two ways:

1. Extract the files to your local file system, and open the oslc.html file in abrowser that permits local HTML files to access the Internet throughXMLHttpRequest. (Of the major browsers, only the Apple Safari Version4.0 browser allows this.)

2. Deploy the files to the same Web server as the CM provider. Consult yourCM provider's application server documentation for appropriate location.

• On an IBM® WebSphere® Application server, place the files in thehtdocs directory.

• On an Apache Tomcat server, place the files in the webappsdirectory

After you have loaded the sample page into your browser, simply enter the baseREST URI into the Service URL text field, and click Go!

For Rational Team Concert, this is typically the path to enter (where <bracketInfo> isa variable for your location):

https://<hostname>:<port>/jazz/oslc/workitems/catalog.xml

Create change requests to use

To create change requests, click New Change Request or, to find an existingchange request, click Find Change Request.

As you create and select items, the sample adds them as links to the page. Clickingthe link opens the change request in a new browser window.

Authentication

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 3 of 22

Page 4: Get to know Open Services for Lifecycle Collaboration

To access protected data in a change management system such as Rational TeamConcert, you typically must furnish a user name and password. OSLC takes a "justenough" approach to integrations, by reusing existing standards where it makessense. Authentication is no exception, and the OSLC-CM 1.0 REST APIspecification states that providers should support Basic HTTP Authentication andOAuth (see Change Management REST API: Security and Authentication).

Therefore, for simplicity, we've assumed here that the change management provideris configured for Basic HTTP Authentication. This lets the browser take care of anylogin prompts for you, making it transparent in the Javascript sample client (seeFigure 1).

Figure 1. A basic HTTP authentication dialog

IBM Rational Team Concert, Rational ClearQuest, and Rational Change can all beconfigured for Basic HTTP Authentication of their OSLC services. For the examplesin this article, we use Rational Team Concert Version 2.0 configured for Basic HTTPAuthentication.

Note:It is also possible to enable this sample to work with other authenticationapproaches. For example, you can simply log into the CM provider's Web userinterface first so that the browser will establish the necessary authenticationprerequisites, and then subsequent requests will be successful.

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 4 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 5: Get to know Open Services for Lifecycle Collaboration

Service discovery

The OSLC-CM 1.0 service discovery model offers the flexibility that you need forvarious change management providers by using a nesting structure for serviceprovider catalogs. From these catalogs, you can locate further information regardingadditional catalogs or documents that describe the completed configuration, whichare known as service description documents. Figure 2 shows an example fromRational Team Concert that provides a single service provider catalog that hasentries for each of its projects, which in turn reference a service descriptiondocument for each project hosted by that server.

Figure 2. Sample of service discovery using Rational Team Concert

The service provider catalog is an optional part of the service discovery process.The catalog provides references to additional catalogs or entries for servicedescription documents. The service description document provides the discoveryend point.

The sample included in the Download section here starts with a URL for either aservice provider catalog or a service description document, as shown in Figure 3.

Figure 3. Enter a URL for service discovery

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 5 of 22

Page 6: Get to know Open Services for Lifecycle Collaboration

If you are new to Dojo and Javascript, this may not be obvious. The code in Listing 1is simply performing an HTTP GET operation on the URL provided, requesting theacceptable content types of either a PROVIDER_CATALOG orSERVICE_DESCRIPTION.

Listing 1. Requesting service discovery documents

dojo.xhrGet({url: url,headers: {

"Accept": OSLC_CONTENT_TYPES.PROVIDER_CATALOG + ',' +OSLC_CONTENT_TYPES.SERVICE_DESCRIPTION

},load: dojo.hitch(this, function (data, ioArgs) {

var catalog, serviceDescription;var rh = ioArgs.xhr.getResponseHeader("Content-Type").split(";", 1);if (rh == OSLC_CONTENT_TYPES.PROVIDER_CATALOG) {

this.catalog = this.parseServiceProviderCatalog(data);if (typeof callback.loadCatalog == 'function') {

callback.loadCatalog(this.catalog);}

} else if (rh == OSLC_CONTENT_TYPES.SERVICE_DESCRIPTION) {this.serviceDescription = this.parseServiceDescriptionDoc(data);if (typeof callback.loadServiceDescription == 'function') {

callback.loadServiceDescription(this.serviceDescription);}

}}),…

Listings 2 and 3 highlight the HTTP request and response.

Listing 2. HTTP request for service discovery

GET https://localhost:9443/jazz/oslc/workitems/catalog.xmlAccept: application/x-oslc-disc-service-provider-catalog+xml,

application/x-oslc-cm-service-description+xml

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 6 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 7: Get to know Open Services for Lifecycle Collaboration

Listing 3. Service provider catalog response

Content-Type: application/x-oslc-disc-service-provider-catalog+xml

<?xml version="1.0" encoding="UTF-8"?><oslc_disc:ServiceProviderCatalogxmlns:oslc_disc=http://open-services.net/xmlns/discovery/1.0/xmlns:dc=http://purl.org/dc/terms/xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#rdf:about="https://localhost:9443/jazz/oslc/workitems/catalog.xml"><dc:title>Project Areas</dc:title>

<oslc_disc:entry><oslc_disc:ServiceProvider><dc:title>JUnit Project</dc:title><oslc_disc:details

rdf:resource="https://localhost:9443/jazz/process/project/1" /><oslc_disc:services

rdf:resource="https://localhost:9443/jazz/oslc/1/wi/services.xml" /></oslc_disc:ServiceProvider>

</oslc_disc:entry><oslc_disc:entry><oslc_disc:ServiceProvider>

<dc:title>Test Automation</dc:title><oslc_disc:details

rdf:resource="https://localhost:9443/jazz/process/project/2" /><oslc_disc:services

rdf:resource="https://localhost:9443/jazz/oslc/2/wi/services.xml" /></oslc_disc:ServiceProvider>

</oslc_disc:entry></oslc_disc:ServiceProviderCatalog>

The response has been altered a bit for this article, but it illustrates the key elementsof the catalog. There are two <oslc_disc:entry> elements, and each has a<oslc_disc:ServiceProvider> element. Knowing that these are references toservice provider's service description documents, we know that we are close. Itwould also be possible to have more catalogs as entries, which the attached samplecode does handle. From the catalog, we see that is has a title of Project Areas,which can be used as a label for a selection list. Likewise, each service providerentry has a <dc:title> element, which can be used as an entry to the selectionlist. Figure 4 shows JUnit Project and Test Automation as options in the drop-downmenu for the Rational Team Concert Project Areas selection.

Figure 4. Display of service providers

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 7 of 22

Page 8: Get to know Open Services for Lifecycle Collaboration

The Javascript used to parse and present the choices simply parses the catalog tolocate the needed elements, then instantiates the appropriate controls.

After a selection is made from the sample, the sample makes another request(Listing 4) in a similar way, although this time the expected response is a servicedescription document.

Listing 4. HTTP request for service description document

GET https://localhost:9443/jazz/oslc/contexts/1/workitems/services.xmlAccept: application/x-oslc-disc-service-provider-catalog+xml,

application/x-oslc-cm-service-description+xml

At this point, you can use the <oslc_disc:services> to determine the URL torequest the document. Listings 5 and 6 show the responses.

Listing 5. Response of service description document (contributor fragment)

Content-Type: application/x-oslc-cm-service-description+xml<?xml version="1.0" encoding="UTF-8"?><oslc_cm:ServiceDescriptorxmlns:dc="http://purl.org/dc/terms/"xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"rdf:about="https://localhost:9443/jazz/oslc/contexts/1/workitems/services.xml"><dc:title>JUnit Project</dc:title><dc:description>IBM Rational Team Concert OSLC CM Service Description for Project'JUnit Project'</dc:description><dc:contributor>

<dc:title>IBM Rational Team Concert Work Items</dc:title><dc:identifier>com.ibm.team.workitem</dc:identifier><oslc_cm:icon>https://localhost:9443/jazz/web/RationalTeamConcert.ico</oslc_cm:icon>

</dc:contributor>…

The <dc:contributor> fragment in Listing 5 provides information about the

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 8 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 9: Get to know Open Services for Lifecycle Collaboration

service provider tool and vendor for informational purposes. There is furtherconfiguration information in the <oslc_cm:changeRequests> section of thedocument that indicates URLs used later in this article for creating and selectingchange requests. See Listing 6.

Listing 6. Response of service description document (changeRequestfragment)

Content-Type: application/x-oslc-cm-service-description+xml...<oslc_cm:changeRequests oslc_cm:version="1.0">

<oslc_cm:home><dc:title>Work Items Home</dc:title><oslc_cm:url>https://localhost:9443/jazz/web/projects/1#action=workitem</oslc_cm:url>

</oslc_cm:home><oslc_cm:creationDialog oslc_cm:default="true"

oslc_cm:hintWidth="740px" oslc_cm:hintHeight="510px"><dc:title>New Defect</dc:title><oslc_cm:url>https://localhost:9443/jazz/WICreation?project=1;dc%3Atype=defect</oslc_cm:url>

</oslc_cm:creationDialog><oslc_cm:creationDialog oslc_cm:hintWidth="740px" oslc_cm:hintHeight="510px"><dc:title>New Plan Item</dc:title><oslc_cm:url>https://localhost:9443/jazz/WICreation?project=1;dc%3Atype=story</oslc_cm:url>

</oslc_cm:creationDialog><oslc_cm:selectionDialog oslc_cm:default="true"

oslc_cm:hintWidth="550px" oslc_cm:hintHeight="360px"><dc:title>Work Item Selection</dc:title><oslc_cm:url>https://localhost:9443/jazz/WIPicker?project=1</oslc_cm:url>

</oslc_cm:selectionDialog><oslc_cm:factory oslc_cm:default="true"><dc:title>Default location for creation of change requests</dc:title><oslc_cm:url>https://localhost:9443/jazz/oslc/contexts/1/workitems</oslc_cm:url>

</oslc_cm:factory><oslc_cm:simpleQuery><dc:title>CQL based change request queries</dc:title><oslc_cm:url>https://localhost:9443/jazz/oslc/contexts/1/workitems</oslc_cm:url>

</oslc_cm:simpleQuery></oslc_cm:changeRequests>

</oslc_cm:ServiceDescriptor>

The key elements for this article are from this discovery document:

• <oslc_cm:creationDialog>

• <oslc_cm:selectionDialog>

These elements provide the information that you need to create an IFrame that canbe used to host these Web page fragments. The following sections will explain, indetail, how this information is used to present these dialogs, with code examples.

Figure 5 shows the sample application after service discovery has been completed.Service discovery is considered complete when a service description document hasbeen obtained.

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 9 of 22

Page 10: Get to know Open Services for Lifecycle Collaboration

Figure 5. Service discovery finished

Delegated Web UIs

OSLC Change Management providers offer more than just REST APIs for accessingdata programmatically. They also give you a way to embed change managementdialogs inside of your applications. These delegated Web UIs are a key aspect ofmany OSLC integrations.

This approach enables developers to build loosely coupled, seamless integrationsbetween ALM tools. You can display feature-rich dialogs from the changemanagement application with minimal knowledge about the application. Additionally,different change management providers can be swapped with virtually no codeimpact to the change management consumer.

Providers support two kinds of delegated Web UIs:

• Creation dialogs

• Selection dialogs

Resource creation

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 10 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 11: Get to know Open Services for Lifecycle Collaboration

You can use creation dialogs to submit new change requests. The changemanagement provider renders the content of these dialogs and, thus, controls bothlayout and validation. An OSLC Change Management consumer can then display afully functioning Submit dialog without duplicating all of the business logic behind thedialog.

Figure 6. Creating a new change request

Figure 7. Resulting link to the new change request

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 11 of 22

Page 12: Get to know Open Services for Lifecycle Collaboration

Imagine that Sue, a tester, is working in a quality management application, such asRational Quality Manager. She finds a bug in the product she tests and needs to filea defect. Ideally, she should be able to create the defect record directly from withinthe quality management application and then store a link in the test execution recordto the newly created defect report. By using OSLC delegated Web UIs, she can dothis and do all of her work within one application.

A provider's creation dialogs are listed as creationDialog elements in the servicedescription XML document, as highlighted in previous sections on service discovery.

Resource selection

What if Sue knows that there is already a defect record for a bug, which is blockingher testing? This time, she uses a delegated selection dialog to link her testexecution record to an existing defect. She can launch this dialog from the sampleby clicking the Find Change Request button, which launches the contributedRational Team Concert window.

Figure 8. Selecting an existing change request

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 12 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 13: Get to know Open Services for Lifecycle Collaboration

Figure 9. Resulting links to change requests

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 13 of 22

Page 14: Get to know Open Services for Lifecycle Collaboration

Again, the change management provider controls the content of this dialog.Therefore, Sue can use any search and query capabilities of the changemanagement application to find the defect record that she is looking for. When shefinds the defect, she adds it as a link in her test execution record, never leaving thequality management tool.

A CM provider's selection dialogs are listed as selectionDialog elements in theservice description document.

IFrame communication

So how does all of this work?

OSLC delegated Web UIs are designed to work across domains, where the changemanagement provider is located on a server different from the host application. Forsecurity reasons, modern Web browsers prohibit HTTP requests to differentdomains. However, OSLC delegated Web UIs are embedded in HTML IFrameelements (see Figure 10). This means that they appear directly within a hostapplication even when the two applications are on entirely different servers indifferent domains. (See the diagram in Figure 10.)

Figure 10. An ALM tool embeds a change management dialog in an IFrame

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 14 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 15: Get to know Open Services for Lifecycle Collaboration

Embedded dialogs send messages back to the host application in one of two ways:by using either the Post Message protocol or the Window Name protocol. The hostapplication determines which protocol to use, based on the browser's capabilities.Listing 7 shows Javascript code to test to see which mode to use and how to createan iFrame from using the results of this test.

Listing 7. Choosing an IFrame protocol

// Tests to see if this browser supports window.postMessageOslcCmConsumer.prototype.isPostMessageSupported = function () {

// Older versions of IE define a method window.postMessage() that does// something else, so we can't simply test for typeof (window.postMessage).if (dojo.isIE && dojo.isIE < 8) {

return false;}

return typeof window.postMessage == 'function';};

// Creates an IFrame to show a Delegated Web UI.OslcCmConsumer.prototype.createIFrame = function (url, container) {

// Determine which IFrame protocol to use.if (this.isPostMessageSupported()) {

this.postMessage(url, container);} else {

this.windowName(url, container);}

};

In Listing 7 there was a function referenced postMessage(), which is a localfunction defined in Listing 8. This function uses the Post Message protocol andworks in the latest versions of most browsers and is preferable. It uses thewindow.postMessage() function in HTML 5 to send events to the observing hostapplication.

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 15 of 22

Page 16: Get to know Open Services for Lifecycle Collaboration

Listing 8. Post Message example

OslcCmConsumer.prototype.postMessage = function (url, container) {// Step 1url += '#oslc-postMessage-1.0';

// Step 2var iframe;var listener = dojo.hitch(this, function (e) {

var HEADER = "oslc-response:";if (e.source == iframe.contentWindow && e.data.indexOf(HEADER) === 0) {

// Step 4window.removeEventListener('message', listener, false);this.handleMessage(e.data.substr(HEADER.length));

}});window.addEventListener('message', listener, false);

// Step 3iframe = document.createElement('iframe');iframe.src = url;

// Display the IFrame.this.styleIFrame(iframe);container.appendChild(iframe);

};

To display a dialog by using the Post Message protocol, you must complete thesesteps:

1. Tell the OSLC-CM provider to use the Post Message protocol byappending this to the dialog URL:#oslc-postMessage-1.0

2. Add an event listener for window message events. The listener tests tosee whether the message content begins with the oslc-response:header, which indicates that this is an OSLC message.

3. Create an IFrame element, and set the IFrame src to the dialog URL.

4. When the window message event is received, remove the event listener,and handle the message that is returned.

The Window Name protocol is more involved, but it must be used in older browsersthat do not support window.postMessage(). As Listing 9 shows, it works aroundcross-site scripting restrictions by passing the OSLC results message as one of thecontent window properties of the IFrame, which the host application can read.

Listing 9. Window Name example

OslcCmConsumer.prototype.windowName = function (url, container) {// Step 1url += '#oslc-windowName-1.0';

// Step 2

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 16 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 17: Get to know Open Services for Lifecycle Collaboration

var iframe = document.createElement('iframe');var frameState = 0;iframe.onload = dojo.hitch(this, function () {

var data;if (!frameState) {

// Step 5try {

// May throw an exception if the IFrame's location is// still a different origindata = iframe.contentWindow.name;if (data != this.returnLocation) {

frameState = 1; // we are done nowif (data) {

this.handleMessage(data);}

}} catch(e) {

// ignore: access exception when trying to access window name}

}});

// Step 3// Set iframe.name to a URL of a blank page on the observer's domain.iframe.name = this.returnLocation;// Step 4iframe.src = url;this.styleIFrame(iframe);container.appendChild(iframe);

};

To display a dialog by using the Window Name protocol, you must follow thesesteps:

1. Tell the OSLC-CM provider to use the Window Name protocol byappending this to the dialog URL:#oslc-windowName-1.0

2. Create an IFrame element and assign a listener for onload events.

3. Set the IFrame's Name property to a blank page on the host application'sdomain. (When the dialog has been closed, the OSLC-CM provider willset the IFrame src to this URL so that the observer can read propertiesof the IFrame.)

4. Set the IFrame src to the dialog URL.

5. In the onload event handler, read the IFrame's contentWindow.nameproperty, which now contains the OSLC response message. The client'sonload event handler is invoked when the CM provider sets the IFramesrc to the return URL.

Unfortunately, working with IFrames in Microsoft® Internet Explorer has a fewquirks. This example omits Internet Explorer workarounds for clarity. See theattached code sample for details (in the Download section).

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 17 of 22

Page 18: Get to know Open Services for Lifecycle Collaboration

The OSLC response message is a Javascript Object Notation (JSON) object thatcontains an oslc_cm:message property, indicating what operation was performed,and an oslc_cm:results property, an array of resources. Each resource is aJSON object with two properties: oslc_cm:label property, which defines a simpledisplay label, and the rdf:resource property, which is the URI of the resourcebeing referenced.

Listing 10. Handling an OSLC response message

var response = dojo.fromJson(message);var messageType = response['oslc_cm:message']; // "oslc_cm:create" or "oslc_cm:select"dojo.forEach(response['oslc_cm:results'], function (next) {

var label = next['oslc_cm:label'];var uri = next['rdf:resource'];// ...

});

A little bit about the final resource URL

After a change request has been created or selected from the previous examples,the result is a URL of a change request resource that can be used to retrieve,update or even delete that change request. Because this article focused onbrowser-based access to these services, it would be natural to expect an HTMLversion of the change request that can be used as a presentation form of the changerequest. As the OSLC-CM specification indicates, other formats can be requested,such as XML or JSON variants. This article highlights only the HTML format byallowing a clickable hyperlink within the sample page. See the Resources section foradditional information.

Summary

This article has taken you through a simple process that starts with a URL anddiscovers the services available by using the Rational Team Concert OSLC-CMprovider. A working sample is included (see Download) that you can use to get abetter understanding of OSLC-CM, to help validate your own provider, or to jumpstart your own consumer implementation. From the service descriptor, you could usedelegated Web user interfaces for creating and selecting change request resources.This discovery and delegation provides a quick and powerful method for achieving aloosely coupled integration. There are many other features in the OSLC-CMspecification, including resource manipulation, query capabilities, other creationmodels, and more.

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 18 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 19: Get to know Open Services for Lifecycle Collaboration

Downloads

Description Name Size Downloadmethod

Sample application. oslc-sample.zip 7KB HTTP

Information about download methods

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 19 of 22

Page 20: Get to know Open Services for Lifecycle Collaboration

Resources

Learn

• See Interact with Remote Data for more details (requires Jazz.net registration).

• Check the latest developments of OSLC by visiting the Open-Services.net Website.

• Learn more about the Rational software mentioned in this article:

• IBM Rational Asset Manager helps you catalog, organize, use, reuse,manage, and report on any type of asset – business, technology orsoftware – across your enterprise

• IBM Rational Change integrated, Web-based, enterprise changemanagement

• IBM Rational Change Management Express, which is included in RationalTeam Concert, with integrated work item tracking

• IBM Rational ClearQuest provides change tracking, process automation,reporting and traceability for better visibility and control

• IBM Rational Quality Manager offers a Web-based, centralized testmanagement environment that provides a collaborative and customizablesolution for test planning, workflow control, tracking, and metrics reporting

• IBM Rational Requirements Composer for collaborative requirementsdefinition and updates for fast-paced projects with high stakeholderinvolvement

• IBM Rational Team Concert provides work item, change management,and build management for real-time collaboration that makes softwareteams more productive and processes more transparent

• Learn about other applications in the IBM Rational Software Delivery Platform,including collaboration tools for parallel development and geographicallydispersed teams, plus specialized software for architecture management, assetmanagement, change and release management, integrated requirementsmanagement, process and portfolio management, and quality management.You can find product manuals, installation guides, and other documentation inthe IBM Rational Online Documentation Center.

• Visit the Rational software area on developerWorks for technical resources andbest practices for Rational Software Delivery Platform products.

• Explore Rational computer-based, Web-based, and instructor-led onlinecourses. Hone your skills and learn more about Rational tools with thesecourses, which range from introductory to advanced. The courses on this

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 20 of 22 © Copyright IBM Corporation 2010. All rights reserved.

Page 21: Get to know Open Services for Lifecycle Collaboration

catalog are available for purchase through computer-based training orWeb-based training. Some of the "Getting Started" courses are available free ofcharge.

• Subscribe to the IBM developerWorks newsletter, a weekly update on the bestof developerWorks tutorials, articles, downloads, community activities, webcastsand events.

Get products and technologies

• Download trial versions of other IBM Rational software.

• Download IBM product evaluation versions and get your hands on applicationdevelopment tools and middleware products from DB2®, Lotus®, Tivoli®, andWebSphere®.

Discuss

• Check out developerWorks blogs and get involved in the developerWorkscommunity.

About the authors

Steve SpeicherSteve Speicher, an IBM senior software engineer, focuses on Rational changemanagement solutions and integrations. He is the lead for the Open Services forLifecycle Collaboration (OSLC) Change Management topic area, which delivers openREST-based specifications, as well as implementations within the Rational changemanagement products. Steve formerly worked in emerging standardization efforts inhealthcare and compound documents (W3C).

Sam PadgettSam Padgett is an IBM advisory software engineer who works within the RationalTeam Concert and Rational ClearQuest development teams on Web-basedtechnologies, OSLC Change Management (OSLC-CM), and Application LifecycleManagement (ALM) product integrations.

Trademarks

Trademarked terms commonly used in developerWorks content are attributed on the

ibm.com/developerWorks developerWorks®

Get to know Open Services for Lifecycle Collaboration Change Management© Copyright IBM Corporation 2010. All rights reserved. Page 21 of 22

Page 22: Get to know Open Services for Lifecycle Collaboration

Trademarks page.

developerWorks® ibm.com/developerWorks

Get to know Open Services for Lifecycle Collaboration Change ManagementPage 22 of 22 © Copyright IBM Corporation 2010. All rights reserved.