It's all about the answers!

Ask a question

Error: (406) Not Acceptable when fetching workitem info via OSLC


Kalyani Deshmukh (111) | asked Aug 02 '19, 2:59 a.m.
edited Aug 02 '19, 5:53 a.m.

I'm writing a Java application to fetch the list of all workitems (Id and Title) for a given Project Area via OSLC.


These are the detailed steps I did (in java application): 
-    Send HTTP GET Request for https://<server>:9443/ccm/rootservices 
      - no authentication is required 
      - returns response with XML stream 
-    Parse the response XML stream 
      - Using the xpath (/rdf:Description/oslc_cm:cmServiceProviders/@rdf:resource) 
      - Extract all cmServiceProviders catalogs 
            => returns https://<server>:9443/ccm/oslc/workitems/catalog 
-    Send HTTP GET Request for https://<server>:9443/ccm/oslc/workitems/catalog 
      - response: authRequired 
      - post authentication form with login credentials 
            => authentication successful 
      - Send HTTP GET Request for https://<server>:9443/ccm/oslc/workitems/catalog once again 
            => returns response with XML stream 
-    Parse the response XML stream 
      - Using the xpath (//oslc:ServiceProvider) 
      - Extract my Project area and its corresponding services link 
           => returns https://<server>:9443/ccm/oslc/contexts/<ID>/workitems/services.xml for my project area 
-    Send HTTP GET Request for https://<server>:9443/ccm/oslc/contexts/<ID>/workitems/services.xml 
      - response: authRequired 
      - post authentication form with login credentials 
          => authentication successful 
      - Send HTTP GET Request for https://<server>:9443/ccm/oslc/contexts/<ID>/workitems/services.xml again 
      - post authentication form with login credentials 
  we are getting this error
            => HTTP/1.1 406 Not Acceptable [X-Powered-By: Servlet/3.0, x-com-ibm-team-scenario: 10.118.58.5, Cache-Control: private, max-age=0, must-revalidate, Expires: Fri, 02 Aug 2019 09:45:20 GMT, Content-Language: en-IN, Content-Length: 0, Connection: Close, Date: Fri, 02 Aug 2019 09:45:21 GMT]
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Why there is an “Error: (406) Not Acceptable” from the server at the last  step ??
My internet searches told me to look into my request’s accept header to look for any incompatible data with the server. But It is not clear to me what is going wrong with the accept header ? 




Also, the same authentication has worked for the previous GET requests like:

https://<server>:9443/ccm/oslc/workitems/catalog

https://<server>:9443/ccm/oslc/contexts/<ID>/workitems/services.xml

Then, why the same authentication fails for the GET request for:

https://<server>:9443/ccm/oslc/contexts/<ID>/workitems

Could you please help ? Thanks in advance. 


Comments
Ralph Schoon commented Aug 02 '19, 5:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Ralph Schoon commented Aug 02 '19, 6:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What are the request headers you send with the GET? 


Kalyani Deshmukh commented Aug 02 '19, 6:20 a.m.

1."Accept", "application/rdf+xml"

2."OSLC-Core-Version", "2.0"

These headers we are sending with the GET request. 

One answer



permanent link
Ralph Schoon (61.1k33643) | answered Aug 02 '19, 6:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 1. See https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/ and understand authentication

2. I authenticated and then followed your steps with Postman and I received correct data (even leaving out the accept and the oslc header in the beginning)


Comments
Ralph Schoon commented Aug 02 '19, 8:19 a.m. | edited Aug 02 '19, 8:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Your answer


Register or to post your answer.