It's all about the answers!

Ask a question

OSLC workshop (Access RM programmatically) : Error 417, Expectation Failed during form based authentication.

m h arvind (111) | asked Nov 24 '21, 3:01 a.m.


I am running the OSLC Workshop and trying to run net.jazz.oslc.consumer.rm.client package.
I am running it against and iFix017

The form based authentication post query return Error 417, Expectation failed at line179 as shown below. Is this a issue with form based authentication, if yes how to get rid of it?

Output log of the execution:

>> Example03: Print out the content of the Service Providers catalog

- Root Services URI:

- Service Providers catalog XPath expression: /rdf:Description/oslc_rm:rmServiceProviders/@rdf:resource

- Service Provider title XPath expression: //oslc:ServiceProvider/dcterms:title

- Login: XXXXX

- Password: XXXX

>> GET(1)

>> Response Headers:

- Date: Wed, 24 Nov 2021 07:34:33 GMT

- Server: Apache

- Strict-Transport-Security: max-age=31536000

- ETag: "gknF/vzdWmHdxB4rzsSKaXvC7dE="

- Expires: Wed, 24 Nov 2021 07:39:33 GMT

- Cache-Control: public

- Content-Type: application/rdf+xml; charset=UTF-8

- Content-Language: en-US

- Keep-Alive: timeout=5, max=86

- Connection: Keep-Alive

- Transfer-Encoding: chunked

- Strict-Transport-Security: max-age=157680000

>> GET(1)

Nov 24, 2021 1:04:43 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies

WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-843b7728b2f545da811551f0de556cab="EUoIwSfRo532nvIEMdDCPTNaUo5dbitZ8Xsyz2q6g"; Version=1; Max-Age=600; Expires=Wed, 24-Nov-2021 07:44:43 GMT; Path=/rm; secure; HttpOnly". Unable to parse expires attribute: Wed

>> Response Headers:

- Date: Wed, 24 Nov 2021 07:34:43 GMT

- Server: Apache

- Strict-Transport-Security: max-age=31536000

- X-com-ibm-team-repository-web-auth-msg: authrequired

- X-XSS-Protection: 1; mode=block

- Content-Type: text/html; charset=UTF-8

- Content-Language: en-US

- Expires: Thu, 01 Dec 1994 16:00:00 GMT

- Cache-Control: no-cache="set-cookie, set-cookie2"

- Set-Cookie: JazzFormAuth=Form; Path=/jts; Secure

- Keep-Alive: timeout=5, max=40

- Connection: Keep-Alive

- Transfer-Encoding: chunked

- Strict-Transport-Security: max-age=157680000


- Date: Wed, 24 Nov 2021 07:35:29 GMT

- Server: Apache

- Content-Length: 312

- Connection: close

- Content-Type: text/html; charset=iso-8859-1

- Strict-Transport-Security: max-age=157680000

org.apache.http.auth.InvalidCredentialsException: Authentication failed

at net.jazz.oslc.utils.HttpUtils.doRRCOAuth(

at net.jazz.oslc.utils.HttpUtils.sendGetForSecureDocument(

at examples.Example03.main(

One answer

permanent link
Ian Barnard (1.8k613) | answered Nov 24 '21, 3:23 a.m.

 I've never tried what you're doing, but the message "org.apache.http.auth.InvalidCredentialsException: Authentication failed" would seem to indicate that the credentials you're using aren't valid.

Ralph Schoon commented Nov 24 '21, 4:29 a.m.

I do not see the body with the username or password. I would in general suggest to use Postman or RESTclient to test if there is an issue with authentication. See

Note there is a whole lot of stuff going on including redirects. Also see for my current status. 

m h arvind commented Nov 24 '21, 5:45 a.m.

Hi Ralph Schoon, Following is the snippet from the example.03 from oslc workshop. Here the username and password are added. While debugging the status error code shows 417. is anything missing in the HTTP post? 

//POST to login form
// The server requires an authentication: Create the login form
HttpPost formPost = new HttpPost(jtsURI+"/j_security_check");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("j_username", login));
nvps.add(new BasicNameValuePair("j_password", password));
formPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
// Step (2): The client submits the login form
System.out.println(">> POST " + formPost.getURI());
HttpResponse formResponse = httpClient.execute(formPost);
if (DEBUG) HttpUtils.printResponseHeaders(formResponse); 

Ralph Schoon commented Nov 24 '21, 6:26 a.m.

The username and the password would be in the variable login and the password in the password. This is not shown here and would cause the issue if done incorrectly.  I have not done the workshop, so I can not comment on anything. In the stack trace your username has an X more than the password.......... 

m h arvind commented Nov 24 '21, 8:03 a.m. | edited Nov 24 '21, 8:17 a.m.

Hi Ralph Schoon, In the log, i have replaced username and password to X`s just to hide it. 

I have tried the REST client authentication in postman app, it returned the response status 200. Only the OSLC workshop code which i pasted above gives the 417 status. 

But i was unable to get status 200 in firefox restClient API

m h arvind commented Nov 24 '21, 8:05 a.m. | edited Nov 24 '21, 8:20 a.m.

Ian Bernard I tried with valid username and password. Also authentication works in postman App. the OSLC workshop code is not working. Have you worked on the java code for authentication, if yes please share it.

Ralph Schoon commented Nov 24 '21, 10:19 a.m. | edited Nov 24 '21, 10:22 a.m.

Just because you get a 200 does not mean you are successfully logged in. Redirect and response headers play a role.  We already shored links with information. Unfortunately this is not easy....

I tried Example 1 - Works
I tried Example 2 - Error 400: The request token was invalid

Maybe I am too stupid, but I was unable to find how to successfully setup the  OAuth Consumer key in JTS in the workshop. I did what I think is correct, but to no avail. Not sure what goes on. If the step can not be completed successfully there is no way to proceed.

showing 5 of 6 show 1 more comments

Your answer

Register or to post your answer.