It's all about the answers!

Ask a question

Extracting java objects


Nicholas McGovern (613) | asked Oct 05 '09, 9:42 p.m.
When using the Java Client API, is there a standard or format for exporting items so they can be used in other programs? For example, if I use the API to retrieve a work item or change set, the API classes will return java objects for those entities. Is there a standard for how to write those objects to a file to be used in another program (such as an xml schema, etc.)?

3 answers



permanent link
Tamir Klinger (91165) | answered Oct 08 '09, 3:17 p.m.
JAZZ DEVELOPER
When using the Java Client API, is there a standard or format for exporting items so they can be used in other programs? For example, if I use the API to retrieve a work item or change set, the API classes will return java objects for those entities. Is there a standard for how to write those objects to a file to be used in another program (such as an xml schema, etc.)?


You might want to ask this on the Jazz Usage forum...

permanent link
ken suy (6) | answered Oct 11 '10, 9:47 a.m.
When using the Java Client API, is there a standard or format for exporting items so they can be used in other programs? For example, if I use the API to retrieve a work item or change set, the API classes will return java objects for those entities. Is there a standard for how to write those objects to a file to be used in another program (such as an xml schema, etc.)?


You might want to ask this on the Jazz Usage forum...


i agree with him there are alot of options and ideas out there

permanent link
lors petersonn (6) | answered Oct 22 '10, 7:15 a.m.
Interacting with the Work Item API

After the HttpClient is configured to use the appropriate authentication protocol for the Rational Team Concert server instance, you can leverage the work item API.

1. Change the HttpContext instance if necessary:
* If you are using basic authentication, you must create an HttpContext instance:

HttpContext localContext = new BasicHttpContext();


* If you are using form-based authentication, use the local HttpContext instance that you created earlier.

2. Now, set up a Get request to your Rational Team Concert server and specify the Accept header. In this example we are accessing the root services document:

HttpGet httpget = new HttpGet("https://myRtcServer:9443/jazz/rootservices");
httpget.setHeader("Accept", "text/xml");


The Accept request header is used to specify which media types are appropriate for the response.

The Get request is then executed by the client:

HttpResponse response = httpclient.execute(httpget, localContext);


The response is read into an HttpEntity instance, and its content is read into an IO stream:

HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();


QNames
It is important to understand the structure of QNames. They are formed by a Prefix (mapped to a Namespace URI) and by a Local Name (or Local Part).
QNames define a valid identifier for Elements and Attributes.

As the stream is read, the XML needs to be parsed to identify and extract the relevant resource URIs. The URI references are represented by Qualified Names, or QNames.

For each resource to be extracted, you must know the Namespace URI and Local Name for both the element and the attribute.

Consider, for example:

<oslc_cm>

goto this :

http://www.ibm.com/developerworks/rational/library/10/programmatic-authentication-and-certificate-handling-for-rational-team-concert-2-0/index.html

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.