It's all about the answers!

Ask a question

OSLC 400 bad request


Ben Pal (91) | asked Jul 05 '22, 8:23 a.m.

Hello,

I would like to get my artifacts from one of my Requirements Management projects using OSLC. I can access the rootservices the catalog and the services.xml. When I try to get the queryBase or do a query on a specific artifact with its own id I get the following:

<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"
    >java.lang.NullPointerException</err:detailedMessage>
    <err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Bad Request</err:errorMessage>
    <err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
    >400</err:errorStatus>
  </rdf:Description>
</rdf:RDF>

And a response with this message:

We're Sorry...

The artifact, component or project cannot be found. It may have been deleted, archived or you may not have access to it. If the Project is enabled for Configuration Management, it may be that the Project is not visible in the given Configuration.

I have checked inside the Project Areas the configuration management should be enabled (This project area is now enabled for configurations.). The requirement was created by using the creation dialog from the services.xml.

The query I used for the single requirement:
queryBase + &oslc.prefix=dcterms=http://purl.org/dc/terms/&oslc.where=dcterms:identifier= ID

Can someone suggest me something?

Thanks,
Ben


Comments
Ian Barnard commented Jul 05 '22, 11:11 a.m. | edited Jul 05 '22, 11:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note the prefix like dcterms=http://purl.org/dc/terms/ isn't correct format because the URL should be surrounded with < and > like dcterms=<http://purl.org/dc/terms/>, and as Ralph says the whole value for prefix MUST be URL encoded (this is an http protocol requirement for building URLs, nothing to do with ELM). And see this article, (although it doesn't mention configurations) https://jazz.net/library/article/1197

2 answers



permanent link
Ralph Schoon (63.5k33646) | answered Jul 05 '22, 10:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 05 '22, 10:06 a.m.

 I would consider to check the URL encoding. This is the query string I create for a valid query:


https://elm.example.com:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Felm.example.com%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_71dE0FpmEeuIQuHbrNptJw&oslc.select=%2A&oslc.where=dcterms%3Aidentifier%3D%22101%22&oslc.prefix=dcterms=%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E&oslc.prefix=foaf=%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E&oslc.prefix=rdf=%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E&oslc.prefix=oslc=%3Chttp%3A%2F%2Fopen-services.net%2Fns%2Fcore%23%3E&oslc.prefix=oslc_cmx=%3Chttp%3A%2F%2Fopen-services.net%2Fns%2Fcm-x%23%3E&oslc.prefix=oslc_cm=%3Chttp%3A%2F%2Fopen-services.net%2Fns%2Fcm%23%3E&oslc.prefix=rtc_cm=%3Chttp%3A%2F%2Fjazz.net%2Fxmlns%2Fprod%2Fjazz%2Frtc%2Fcm%2F1.0%2F%3E&oslc.prefix=rtc_ext=%3Chttp%3A%2F%2Fjazz.net%2Fxmlns%2Fprod%2Fjazz%2Frtc%2Fext%2F1.0%2F%3E&oslc.prefix=jazz=%3Chttp%3A%2F%2Fjazz.net%2Fns%2Fjazz%23%3E&oslc.prefix=process=%3Chttp%3A%2F%2Fjazz.net%2Fns%2Fprocess%23%3E&oslc.prefix=oslc_pl=%3Chttp%3A%2F%2Fopen-services.net%2Fns%2Fpl%23%3E&oslc.prefix=acc=%3Chttp%3A%2F%2Fopen-services.net%2Fns%2Fcore%2Facc%23%3E&oslc.prefix=acp=%3Chttp%3A%2F%2Fjazz.net%2Fns%2Facp%23%3E&oslc.prefix=jazz_rm=%3Chttp%3A%2F%2Fjazz.net%2Fns%2Frm%23%3E&oslc.pageSize=50&_startIndex=0

For the identifier I have this in the query string: &oslc.where=dcterms%3Aidentifier%3D%22101%22 where the identifier is 101. Actually the ID is "101".

You could check Ians open souce project: https://github.com/IBM/ELM-Python-Client that might help with understanding the OSLC query mechanism.


Comments
Ian Barnard commented Jul 05 '22, 11:15 a.m. | edited Jul 05 '22, 11:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 There are also some headers needed, e.g. OSLC-Core-Version: 2.0 and Accept: application/rdf+xml, and if configuration management is enabled you must provide the URI of the configuration as either an extra parameter &oslc_config.context=(encoded URI of the config) or header Configuration.context: (the URI of the config).


Ian Barnard commented Jul 05 '22, 11:18 a.m. | edited Jul 05 '22, 11:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 See here for an example of finding the configurations in a project https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area/266667


permanent link
Ben Pal (91) | answered Jul 07 '22, 10:05 a.m.

Thanks for the answers, at first glance the ELM-Python-Client would do most of the things I would like. Unfortunately I get  the same 400 Client Error.
Created two requirement projects one with configuration management and one without it. Tried both examples but neither of them works.

oslcquery -J https://my.server:port -U YOURUSERNAME -P YOURPASSWORD -p "My RM Project" -s dcterms:identifier,dcterms:title -O rmresults.csv

oslcquery -J https://my.server:port -U YOURUSERNAME -P YOURPASSWORD -p "My RM Project" -F "stream name" -s dcterms:title -O rmresults.csv

The headers OSLC-Core-Version: 2.0 and Accept: application/rdf+xml are set. "I can access the rootservices the catalog and the services.xml." Also created a requirement with the Requirement Creation Factory.
Will take a look at https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area when have the time.


Comments
Ian Barnard commented Jul 07 '22, 11:25 a.m. | edited Jul 07 '22, 11:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Thanks for trying out my OSS! Note it's my personal project not an IBM codebase, and is not tested for production use, up to you to verify it meets your needs. You never did say what version+ifix you're using? Those commands work for me against 7.0.2 for bot an opt-in and an opt-out project


Ian Barnard commented Jul 07 '22, 11:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You could raise this as an issue in github https://github.com/IBM/ELM-Python-Client/issues


Ian Barnard commented Jul 07 '22, 12:48 p.m. | edited Jul 07 '22, 12:51 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You could also try the latest version 0.8: pip install -U elmclient although I've not consciously fixed a problem with a 400 error.




Ben Pal commented Jul 11 '22, 10:30 a.m.

I think that the problems are caused by the version, currently running doors next gen 6.0.6.1 out of the box.








Ian Barnard commented Jul 13 '22, 8:08 a.m. | edited Jul 13 '22, 8:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I've run oslcquery against 6.0.6.1 GA without any real issues apart from for an opt-out project having to specify a component using -C and the same name as the project (this is fixed in latest 0.8.1).

Otherwise for a problem description as vague as "400 error" it's impossible to help - if you want any help with the 400 error please create an issue on  https://github.com/IBM/ELM-Python-Client/issues oincluding as much detail as you get from the console trace and I'll try to help there (no guarantees!)

You're running 6.0.6.1 without any iFixes? You should update to the latest ifix 026. 6.0.6.1 is going out of support in September 2022 so you should plan to migrate to 7.0.2 iFix014.

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.