Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to post a FileArtifact using RQM CopyUtility ?

I am trying to upload a changed csv file into a datapool . I tried using the client.putFileArtifact("datapool",datapool_ID,stringData.getBytes(),filename) , but I get the following error trace :

I tried with UTF-8 Encoding of string data but with same error.




RestException executing: PUT File Artifact, RC: 400, message: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Error xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/"><statusCode>400</statusCode><message>The uploaded content does not match the XML schema for datapool</message><trace>javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: Content is not allowed in prolog.]
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:502)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:207)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:176)

0 votes



2 answers

Permanent link
Hi Vivek,

The datapool resource (https://jazz.net/products/rational-quality-manager/api-doc-4.0/api-files/schemas/qm_xsd/elements/datapool_1.html) represents the test data properties, including the data file (https://jazz.net/products/rational-quality-manager/api-doc-4.0/api-files/schemas/qm_xsd/elements/datapool_1.html#r8).  As such, the data file is uploaded as an attachment resource (https://jazz.net/wiki/bin/view/Main/RqmApi#Resources_and_their_Supported_Op).  Note, footnote 6.

0 votes

Comments

Thanks Paul


Permanent link
Hi Paul - Thanks for the help . With your inputs and looking at the copyTool code , i was able to do the needful. The final working code is :

com.ibm.rqm.xml.bind.Datapool datapool = (com.ibm.rqm.xml.bind.Datapool) client.getArtifact("datapool", dpHref);
String attachHref =  datapool.getAttachment().getHref();
FileContent f = client.getFileArtifact("attachment",attachHref);
clent.putFileArtifact("attachment", attachHref, MyDataString.getBytes(), f.fileName);

It was the filename which was causing the problem . Using the f.fileName solved the problem.

Thanks again for your help !!

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jul 12 '12, 7:27 a.m.

Question was seen: 4,693 times

Last updated: Jul 17 '12, 12:29 a.m.

Confirmation Cancel Confirm