Problem in setting up the catalog request, oauth
Hi
I'm trying to follow example03 in https://jazz.net/wiki/pub/Main/OSLCWorkshopDownload/2012-11-26-OSLC-workshop.pdf (page 122)
// Setup the catalog request
HttpGet catalogDoc = new HttpGet(serviceProvidersCatalog);
catalogDoc.addHeader("Accept", "application/xml");
catalogDoc.addHeader("OSLC-Core-Version", "2.0");
// Access to the Service Providers catalog
HttpResponse catalogResponse = HttpUtils.sendGetForSecureDocument(server, catalogDoc, login, password, httpclient,JTS_Server);
But I have some problems in setting up the catalog request. I get the following warnings:
11-04-2013 15:31:18 org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-913f9ffccdac49368e6990cea35ea3b7="TTqmqmy9qeDy5FYm2frwVow5DDFTgMzmcjJeTBP6Q5M"; Version=1; Max-Age=600; Expires=Thu, 11-Apr-2013 13:41:17 GMT; Path=/rm". Unable to parse expires attribute: Thu
11-04-2013 15:31:18 org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm=https://MyServer/jts/oauth-authorize}
11-04-2013 15:31:18 org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-54ab9c79ac204820a7fc4d76398c19c0="t6nEXJ4c1O0DCwciazFiemcSBhVM2t9iNiR9SApew"; Version=1; Max-Age=600; Expires=Thu, 11-Apr-2013 13:41:18 GMT; Path=/rm". Unable to parse expires attribute: Thu
11-04-2013 15:31:18 org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm=https://MyServer/jts/oauth-authorize}
Any ideas on how to solve this?
If I try to get services.xml via httpRequester, I get 200 OK.
One answer
<br>
After the first 2 warnings, you should see the following:
<br>
<br>
<pre>
>> Response Headers:
- Server: Apache-Coyote/1.1
- set-cookie: jfs-oauth-access-token0=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/rm
- set-cookie: jfs-oauth-access_token-secret0=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/rm
- set-cookie: jfs-request-token-a5a61000ab794795b809ca8d79e323e0="UhsDgJExbNKUzMageCqsviIX4nj2ioNJ1DZnniKvI"; Version=1; Max-Age=600; Expires=Thu, 09-May-2013 21:27:43 GMT; Path=/rm
- X-jazz-web-oauth-url: https://clm.jkebanking.net:9443/jts/oauth-authorize?oauth_token=a5a61000ab794795b809ca8d79e323e0
- WWW-Authenticate: OAuth realm=https://clm.jkebanking.net:9443/jts/oauth-authorize
- Content-Type: text/html
- Content-Length: 342
- Date: Thu, 09 May 2013 21:17:43 GMT
>> Response Headers:
- Server: Apache-Coyote/1.1
- Cache-Control: private
- Expires: Wed, 31 Dec 1969 19:00:00 EST
- Set-Cookie: JSESSIONID=23FC042E38F11D22EFA6F6AEB2A2D412; Path=/jts/; Secure; HttpOnly
- X-com-ibm-team-repository-web-auth-msg: authrequired
- Location: https://clm.jkebanking.net:9443/jts/authenticated/identity?redirectPath=%2Fjts%2Foauth-authorize%3Foauth_token%3Da5a61000ab794795b809ca8d79e323e0
- Content-Length: 0
- Date: Thu, 09 May 2013 21:17:43 GMT
>> Response Headers:
- Server: Apache-Coyote/1.1
- Cache-Control: private
- Expires: Wed, 31 Dec 1969 19:00:00 EST
- Set-Cookie: JazzFormAuth=Form; Path=/jts
- X-com-ibm-team-repository-web-auth-msg: authrequired
- Content-Type: text/html;charset=UTF-8
- Content-Length: 2867
- Date: Thu, 09 May 2013 21:17:43 GMT
>> POST https://clm.jkebanking.net:9443/jts/j_security_check
- Server: Apache-Coyote/1.1
- Location: https://clm.jkebanking.net:9443/jts/authenticated/identity?redirectPath=%2Fjts%2Foauth-authorize%3Foauth_token%3Da5a61000ab794795b809ca8d79e323e0
- Content-Length: 0
- Date: Thu, 09 May 2013 21:17:43 GMT
>> Response Headers:
- Server: Apache-Coyote/1.1
- Cache-Control: private
- Expires: Wed, 31 Dec 1969 19:00:00 EST
- Set-Cookie: JSESSIONID=F3CEA98DFDFD459D93D166CF42B77ED8; Path=/jts/; Secure; HttpOnly
- Set-Cookie: JSESSIONIDSSO=A764B3E7185F58CD63DA6DD3D5E97832; Path=/; Secure; HttpOnly
- Set-Cookie: X-com-ibm-team-foundation-auth-loop-avoidance=false
- Location: https://clm.jkebanking.net:9443/jts/oauth-authorize?oauth_token=a5a61000ab794795b809ca8d79e323e0
- Content-Length: 0
- Date: Thu, 09 May 2013 21:17:43 GMT
>> POST https://clm.jkebanking.net:9443/jts/j_security_check
- Server: Apache-Coyote/1.1
- Content-Length: 0
- Date: Thu, 09 May 2013 21:17:43 GMT
</pre>
Comments
Bas Bekker
JAZZ DEVELOPER Apr 12 '13, 11:41 a.m.Helene, you did get through the HttpUtils.sendGetForSecureDocument method?
helene højrup
Apr 16 '13, 7:30 a.m.Hi Bas,
Sorry for the late answer. I've had some problems logging in...
Well I'm able to get through the HttpUtils.sendGetForSecureDocument when I request for the root services docment, but not when trying to access the catalog request.
When debugging when trying to setup the catalog request
HttpGet catalogDoc = new HttpGet(serviceProviderCatalog)
I get aborted = false and exclusiveOwnerThread = null, and connRequest = null (among others).