It's all about the answers!

Ask a question

Export WorkItem as XML while Saving


Imran Akbar (56278) | asked Nov 22 '11, 8:20 a.m.
Can we able to export/get the Current WorkItem in XML, i require this XML once the WorkItem is saved, how can we acheive this through a Advisor Plugin?

Thanks in advance

6 answers



permanent link
Eduardo Bello (4401922) | answered Dec 01 '11, 2:27 p.m.
How about using REST API?

https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2


You can request an XML representation of an workitem calling a URL like this:

rtc3.mvrec.local:9443/jazz/oslc/workitems/WorkItemNumber.xml


You also can save an workitem from a xml using REST API, using PUT requests. Read more...



But if you really want to use advisors/participant, you just need to do a normal java programming to read/write a xml file. You can even make a Class to represent your xml workitem with just the information you want. Using JAXB library will make your work easier.

permanent link
Henry Armburg Jennings (13076) | answered Dec 02 '11, 9:42 a.m.
Thanks for this information bello,very useful.

What is the syntax for the URL though as I can't quite get it to work? Is 'oslc' the project name and does the WorkItemNumber need to be '1' or '001'. Also, if 'oslc' is the project name, how does the URL handle spaces between words?

Thanks.

permanent link
sam detweiler (12.5k6195201) | answered Dec 04 '11, 8:34 a.m.
I used the following RESTful url to get the xml for workitem 11

note that this is NOT project dependent a workitem is a workitem

https://localhost:9643/ccm/oslc/workitems/11.xml

note that in the results there are lots of fields you will have to retrieve individually..

Sam

permanent link
Eduardo Bello (4401922) | answered Dec 07 '11, 9:41 a.m.
Thanks for this information bello,very useful.

What is the syntax for the URL though as I can't quite get it to work? Is 'oslc' the project name and does the WorkItemNumber need to be '1' or '001'. Also, if 'oslc' is the project name, how does the URL handle spaces between words?

Thanks.


Hi,


"oslc" is not the project name and the workitem number does not have format, it is the id (1,45,65876...) The URL I posted was an example that works with our internal server here. As we can see in sdetweil post, the URL depends three informations, 1) the server address 2) the server port 3) RTC application shortcut (in older versions it was "jazz", but in recent version it is "ccm").


http:// serveraddress : serverport/ rtc appname / oscl / workitems / number.xml


Examples:


http://localhost:9443/ccm/oslc/workitems/1.xml
http://localhost:9443/jazz/oslc/workitems/1.xml
http://intranet:9443/ccm/oslc/workitems/1.xml
http://rtc.mycompany.com:9643:/ccm/oslc/workitems/1.xml

permanent link
Imran Akbar (56278) | answered Dec 08 '11, 2:24 a.m.
Thanks a lot for this info Bello.

Yes, by calling the URL i get Workitem XML, we could make a http post call and access the xml from the Advisor plugin if the work item is already saved. but to get the current workitem, will read the required fields from plain java code and write it as XML as your second point suggested.

Thanks

permanent link
Henry Armburg Jennings (13076) | answered Dec 08 '11, 1:15 p.m.
thank you very much for this bello, it needed https for it to work for me FYI but this is very useful. Henry

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.