It's all about the answers!

Ask a question

How to Create Requirements in other Components than the Default Component


magnus Elfving (348) | asked Apr 14 '21, 7:43 a.m.

  Hi,


I am only succeeded in creating requirements in folders located in one (default?) of three components of the project I am working in. I am not able to direct the POST requirement factory message to operate on the two other components.

How can I direct the creation of requirements to folders (and modules) located in a component of my choice?

Regards Magnus   

Accepted answer


permanent link
Ian Barnard (2.3k613) | answered Apr 14 '21, 10:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Hi Magnus


You need to include a header Configuration-Context with your POST, with the URI of a configuration in the component you want to create the requirement it

HTH
Ian

Ian Barnard selected this answer as the correct answer

Comments
magnus Elfving commented Apr 14 '21, 1:44 p.m. | edited Apr 14 '21, 2:02 p.m.

 Hi Ian,


and thanks for your answer!

I have tried as you suggested, and also, read your answer in "https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area"  and found the URI of the configuration of my non-default Component and accordingly added:
httpWebRequest.Headers.Add("Configuration-Context", "https://.../rm/configSelections/stream/_m7mO8HUeEeuc2f2NAwVSqg") 
to my POST
However, the request responds with: "(400) Bad Request"

If I remove the header above, the POST results in the creation of a new requirement in the default component.

Have I found a faulty URI?

Regards 
Magnus    


Ian Barnard commented Apr 15 '21, 9:22 a.m. | edited Apr 15 '21, 9:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

To get things working you can always manually get the configuration URL from a 'Share link to artifact' of an artifact in the component+configuration you want to create in.


Please confirm your configuration URL is valid, i.e. with a HOST:PORT i.e. not literally starting with https://.../ ?

Maybe try header oslc_config.context instead of Configuration-Context.

My starting point for getting these operations to work is to start by using a REST client in a browser, then once it's working ensure code sends precisely the same pattern of content/header to the same URL.


magnus Elfving commented Apr 16 '21, 2:37 a.m.
The URL form is in the format https://x.x.x.x/gc/configuration/48 and the oslc_config.context does not work.

"Share link to artifact" for a artefact in a non-default component is:

However, I just noted that when I export requirements from DNG to excel I receive the following meta data:

Default Component:

Non-default Component: 

  


Ian Barnard commented Apr 20 '21, 11:00 a.m. | edited Apr 20 '21, 11:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What version+iFix are you using? This definitely works - like I say, to reduce the variables (each being a possibility for it not working), try doing this POST using a REST client in your browser.


You probably aren't posting to the creation factory for the component - you have to use the local configuration to retrieve the factory URLs, as (I think) described in that other post of mine you mentioned. In fact you may have to use the local configuration URL to do the POST, not sure.


At the part starting "Accessing the services.xml without a configuration will give you the details for the default component." ...
read on, how to get the factory URLs for the component using the local config.


magnus Elfving commented Apr 21 '21, 10:56 a.m. | edited Apr 21 '21, 10:57 a.m.
Hi,

now it is working !

It start to work when I added the header, see below, holding the URI to the non-default component stream, along with my initial queries (OSLC API GET) in order to acquire the capabilities for Query, FolderQuery and CreationFactory. 

httpWebRequest.Headers.Add("Configuration-Context", "https://x.x.x.x/rm/cm/stream/_m7mO8HUeEeuc2f2NAwVSqg")

Furthermore, I added the same header to my POST when creating the new requirement.

Note, if I remove the header in my initial GET, the URI to the capabilities remained the same, though the following POST failed with "(400) Bad Request".

Regards Magnus 

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.