It's all about the answers!

Ask a question

POST requirement and primary text (with OLSC API) - wrong formatting


Luis Silva (257) | asked May 16 '16, 10:28 a.m.
edited May 16 '16, 10:39 a.m.
 Hi,

I have the following atribute in a requirement <oslc_rm:Requirement>:

I'm trying a simple operation of creating a new requirement with a table in jazz_rm:primaryText:

So I used the link:

===
https://localhost:9443/rm/requirementFactory?projectURL=https://localhost:9443/rm/process/project-areas/_Mu4ToBLbEea_geXMea33fg:
==

With Headers:

OSLC-Core-Version 2.0
Accept application/rdf+xml
Content-Type application/rdf+xml
and I passed the following POST body:

===
rdf:RDF
(..)
            <jazz_rm:primaryText rdf:parseType="Literal">
              div xmlns="http://www.w3.org/1999/xhtml">
                  p dir="ltr"> </p>
                  table border="1" cellpadding="1" cellspacing="1" dir="ltr" id="_1463401786702" style="width:500px">
                    <body>
                          tr>
                              td colspan="1" rowspan="1" style="width: 250px;">a</td>
                              td colspan="1" rowspan="1" style="width: 250px;">1</td>
                          /tr>
                          tr>
                              td colspan="1" rowspan="1" style="width: 250px;">b</td>
                              td colspan="1" rowspan="1" style="width: 250px;">2</td>
                          /tr>
                          tr>
                              td colspan="1" rowspan="1" style="width: 250px;">c</td>
                              td colspan="1" rowspan="1" style="width: 250px;">3</td>
                          /tr>
                      /tbody>
                  /table>
                  p dir="ltr"> </p>
              /div>
            </jazz_rm:primaryText>
(...)

==
I get a 403 response and an error message saying:
===

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:err="http://jazz.net/xmlns/prod/jazz/foundation/1.0/">
  <rdf:Description>
    <err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >CRRRS6401E  Error parsing content. Content must be valid rdf+xml.</err:detailedMessage>
    <err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Forbidden</err:errorMessage>
    <err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
    >403</err:errorStatus>
  </rdf:Description>
</rdf:RDF>
==

"Content must be valid rdf+xml.". What am I doing wrong? If I delete  the <jazz_rm:primaryText > the item is created so I know the problem is there. (I had to remove some opening tags "<" so that tables wouldn't appear

Thank you!

Accepted answer


permanent link
Gabriel Ruelas (1.1k13) | answered May 16 '16, 10:46 a.m.
Hi,  I suggest you to manually create an artifact in RM WEB UI that have the desired table, then do a get to that artifact and use the primary text returned there to create a new using oslc.  If that works then try to adapt your primary text to the format exposed by OSLC.
Luis Silva selected this answer as the correct answer

Comments
Luis Silva commented May 16 '16, 10:51 a.m. | edited May 16 '16, 10:55 a.m.

 Hi Gabriel,


That was my first idea. I created an artifact and checked the URI resource link which gave me exactly the format that I used to make the POST. However, when posting, this error appeared..Does the format differ between get and post?


Gabriel Ruelas commented May 16 '16, 10:53 a.m.

Hi Luis, nop, it must be the same. If that does not work, pls open a defect for it.


Luis Silva commented May 16 '16, 11:18 a.m.

 Let me seek further documentation and if the problem remains I will open a defect.


Luis Silva commented May 18 '16, 11:56 a.m.

You were absolutely right! I was the one that copied the information from the GET post wrong..

Your answer


Register or to post your answer.