OSLC workshop (Access RRC programmatically) : Warnings "Invalid cookie header & Authentication error"
Hi,
I am running the OSLC Workshop and trying to run example03.java net.jazz.oslc.consumer.rm.client package.
I am running it against a RRC 5.0.1 and JTS 5.0.1.
The exemple should list all the RRC project areas unfortunately the result contains errors and the list is empty
Below the output of Java execution
>> Example03: Print out the content of the Service Providers catalog
- Root Services URI: https://rrc.server:9443/rm/rootservices
- Service Providers catalog XPath expression: /rdf:Description/oslc_rm:rmServiceProviders/@rdf:resource
- Service Provider title XPath expression: //oslc:ServiceProvider/dcterms:title
- Login: XXXX
- Password: kkkk
Setup the HttClient
Setup the rootServices request
Send Get For Secure Document
>> GET(1) https://rrc.server:9443/rm/rootservices
>> Response Headers:
- Date: Tue, 30 Jan 2018 22:49:04 GMT
- X-Powered-By: Servlet/3.0
- ETag: "AH/17yEggYY2So/mDsLmbqwTJbk="
- Expires: Tue, 30 Jan 2018 22:54:04 GMT
- Cache-Control: public
- Keep-Alive: timeout=10, max=100
- Connection: Keep-Alive
- Transfer-Encoding: chunked
- Content-Type: application/rdf+xml; charset=UTF-8
- Content-Language: en-US
>> GET(1) https://rrc.server:9443/rm/oslc_rm/catalog
ene 30, 2018 11:49:06 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
AVISO: Invalid cookie header: "Set-Cookie: jfs-request-token-7b22ee182a694ef9a77bbbed183173bd="w0GGH6EProNvcdaT2SqDVWGAVgCrWaCHldR6CtQ38pg"; Version=1; Max-Age=600; Expires=Tue, 30-Jan-2018 22:59:04 GMT; Path=/rm; secure". Unable to parse expires attribute: Tue
ene 30, 2018 11:49:06 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
AVISO: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm=https://rtc.server:59443/jts/oauth-authorize}
>> Response Headers:
- Date: Tue, 30 Jan 2018 22:49:04 GMT
- X-Powered-By: Servlet/3.0
- Set-Cookie: jfs-oauth-access-token0=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/rm; secure
- Set-Cookie: jfs-oauth-access_token-secret0=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/rm; secure
- Set-Cookie: jfs-request-token-7b22ee182a694ef9a77bbbed183173bd="w0GGH6EProNvcdaT2SqDVWGAVgCrWaCHldR6CtQ38pg"; Version=1; Max-Age=600; Expires=Tue, 30-Jan-2018 22:59:04 GMT; Path=/rm; secure
- X-jazz-web-oauth-url: https://rtc.client:59443/jts/oauth-authorize?oauth_token=7b22ee182a694ef9a77bbbed183173bd
- WWW-Authenticate: OAuth realm=https://rtc.client:59443/jts/oauth-authorize
- Content-Length: 350
- Expires: Thu, 01 Dec 1994 16:00:00 GMT
- Cache-Control: no-cache="set-cookie, set-cookie2"
- Keep-Alive: timeout=10, max=99
- Connection: Keep-Alive
- Content-Type: text/html
- Content-Language: en-US
How can I get rid of this problem ?
One answer
You're not authenticated when doing the GET /rm/oslc_rm/catalog
If you look at section 6.3 (Jazz Form-based Authentication) of the OSLC workshop, you see the authentication code and wraps request in logic that uses the authentication code (the sendGetForSecureDocument method). You need to debug the authentication code to see what goes wrong there.