It's all about the answers!

Ask a question

RQM 5.0.2 Getting execution result attachements through REST API


harshal Wable (17315) | asked Sep 07 '15, 4:48 a.m.
I am using REST API for accessing RQM Test Plan details.
Now I need is to get Execution results through REST API. I am able to fetch the details , however it has some screen shots / Images which I am not able to download through my code. It needs browser to download it . Execution result link which through which I would be able to download the attachements / Images through my code.

3 answers



permanent link
Reshma Ratnani (1.1k1) | answered Sep 07 '15, 5:27 a.m.
JAZZ DEVELOPER
Hi Harshal,

Can you try using the href value of the attachment tag coming as part of ExecutionResult xml

Comments
harshal Wable commented Sep 07 '15, 5:49 a.m.

Yes I am using the href value 
which is this in this case



This is what I am getting 
https://rtcclm2:9443/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_k1F6wUzPEeWXOuHUUui6Mw

However when I download this using
C:\Program Files\Internet Explorer>java.exe -jar C:\Users\IBM_ADMIN\Downloads\RQ
M-Extras-RQMUrlUtil-4.0.3\RQMUrlUtility.jar -command GET -user ckumar45@in.ibm.c
om -password 12345 -filepath C:\testplan\testplan.jpg -url "https://rtcclm2:94
43/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/
_g2unwUzPEeWXOuHUUui6Mw"
 

It gives me corrupted file or Big file error


permanent link
harshal Wable (17315) | answered Sep 07 '15, 6:38 a.m.
I am using the same. the image which we get from it is corrupted or too big .

Below is the command I using
C:\Program Files\Internet Explorer>java.exe -jar C:\Users\IBM_ADMIN\Downloads\RQ
M-Extras-RQMUrlUtil-4.0.3\RQMUrlUtility.jar -command GET -user ckumar45@in.ibm.c
om -password 12345 -filepath C:\\testplan\\testplan.jpg -url "https://rtcclm2:94
43/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/
_g2unwUzPEeWXOuHUUui6Mw"



Comments
Donald Nong commented Sep 07 '15, 8:43 p.m.

Have you tried with the version 5.0.2 of RQM URL Utility?


harshal Wable commented Sep 08 '15, 3:48 a.m. | edited Sep 08 '15, 9:54 p.m.

Yes , I tried same issue I am facing with 5.0.2 .
This is the command execution
C:\Users\IBM_ADMIN\Downloads\RQM-Extras-RQMUrlUtil-5.0.2>java.exe -jar C:\Users\
IBM_ADMIN\Downloads\RQM-Extras-RQMUrlUtil-5.0.2\RQMUrlUtility.jar -command GET -
user ckumar45@in.ibm.com -password 12345 -filepath C:\RQM_Attachment.png -url "
https://rtcclm2:9443/qm/service/com.ibm.rqm.planning.service.internal.rest.IAtta
chmentRestService/_g2unwUzPEeWXOuHUUui6Mw"
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                  <<<<<----- [ RQMUrlUtility ] ---->>>>>
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Default cookie policy RFC_2109 is used.
RQMUrlUtility: Connected to https://rtcclm2:9443 using project "cclm2:9443"
Attempting to create SSL_TLS context
java.security.NoSuchAlgorithmException: SSL_TLS SSLContext not available
Unable to create SSL_TLS context, trying SSLv3
RQMUrlUtility: Calling [ HTTP GET ] method to retrieve XML from a specified URL
RQMUrlUtility: Server Response code: 200
RQMUrlUtility: [ SUCCESS ] XML string retrieved from URL : "https://rtcclm2:9443
/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_g
2unwUzPEeWXOuHUUui6Mw " is written to file located at -: " C:\RQM_Attachment.pn
g "
Disconnecting from the IBM Rational Quality Manager server.

This is what I am getting when I open the file



Donald Nong commented Sep 09 '15, 3:21 a.m.

You don't have enough reputation to attach a screen shot here. Upload it somewhere else and link back here. Also, have you tried to open the file in a binary editor to see what the content looks like? You may be surprised to see what actually is in the file.


permanent link
Donald Nong (14.5k414) | answered Sep 10 '15, 1:11 a.m.
Harshal sent me the corrupted PNG file and I noticed that it was tagged with the UTF-8 BOM (the first six byes are EF BF BD 50 4E 47) while the first four bytes of a PNG file should be 89 50 4E 47. So it appears that the tool treats the stream as a string rather than binary. In fact, we can see the message "RQMUrlUtility: Calling [ HTTP GET ] method to retrieve XML from a specified URL" in the command output.

Strictly speaking, the IAttachmentRestService API is an internal API, not RQM Reportable REST API, so we can't expect it to work with any URLs.

Since the source code is included in the tool, we can build the tool with some minor changes so that it can work with the internal attachment URL.
1. Locate the file RQMUrlUtility\src\com\ibm\rqm\url\client\RQMUrlGET.java.
2. Locate this line - it works for the "attachment" resource when using RQM Reportable REST API
        if (sAttachURL.indexOf("attachment") == -1) {
3. Change it as shown below - now it takes care of IAttachmentRestService API as well
        if (sAttachURL.indexOf("attachment") == -1 && sAttachURL.indexOf("IAttachmentRestService") == -1) {
4. Rebuild the tool.

If the tool works correctly, we should see this message in the command output.
RQMUrlUtility: Calling [ HTTP GET ] method to download an attachment

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.