Unable to get JSESSIONID from login post request to https site

1,142 views
Skip to first unread message

Rakesh Prabhakaran

unread,
Feb 19, 2015, 1:38:54 AM2/19/15
to rest-a...@googlegroups.com
I found similar posts in different groups,  but none of the them helped.

As I am  trying to do a login request to my application from restassured (the application running in my tomcat server in my local host), I am able to get the JSESSIONID and use it to make other get requests .
But when the application in hosted in the test server with https authentication, I am getting issues.
I added key stroke and password and is allowing the handshake, also getting two cookie values other than JSESSIONID as part of my login post request, but no session getting created.
It gives a response "getsessionid" is null.
Also tried filtersession, there also session is shown as null.
Any pointers to fix this  will be of much help.

Johan Haleby

unread,
Feb 19, 2015, 5:45:52 AM2/19/15
to rest-a...@googlegroups.com
Hi,

Could you log the response (use ".then().log().all()") and paste the outcome here?

/Johan

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rakesh Prabhakaran

unread,
Mar 5, 2015, 12:04:42 AM3/5/15
to rest-a...@googlegroups.com
Sorry for the  delay.

<html>
  <head>
    <title>
Redirection in progress...
              <noscript>
        <style type="text/css">
         body &gt; div { display: none; }
        </style>
      </noscript>
    </title>
  </head>
  <body>
    <div>
      <header>
        <h3>Please wait, while you are being redirected...</h3>
      </header>
    </div>
  </body>
</html>

Rakesh Prabhakaran

unread,
Mar 5, 2015, 12:38:42 AM3/5/15
to rest-a...@googlegroups.com
Also I tried RestAssured.config = newConfig().redirect(redirectConfig().followRedirects(true));
but no help. When tried to analyze the call through fiddler, I can find that so many internal calls being done after the login post request, before the application loads after authentication.
The app is SPA. Also its using webseal.

Rakesh Prabhakaran

unread,
Mar 5, 2015, 1:00:56 AM3/5/15
to rest-a...@googlegroups.com
I doubt it could be because of the 302 response that I am getting from the post request.
I just found this post http://www.jayway.com/2012/10/17/what-you-may-not-know-about-http-redirects/.
Still what's confusing me is that I was able to do that in my local host but not with the https version.

Johan Haleby

unread,
Mar 5, 2015, 2:17:24 AM3/5/15
to rest-a...@googlegroups.com
You could also provide the headers?

Johan Haleby

unread,
Mar 5, 2015, 2:18:25 AM3/5/15
to rest-a...@googlegroups.com
And by headers I mean the response headers you ought to see when doing "log().all()" on the response.

Rakesh Prabhakaran

unread,
Mar 23, 2015, 12:11:54 AM3/23/15
to rest-a...@googlegroups.com
HTTP/1.1 302 Moved Temporarily
content-length: 302
content-type: text/html
date: Mon, 23 Mar 2015 04:09:44 GMT
location: https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXdoLogon
p3p: CP="NON CUR OTPi OUR NOR UNI"
cache-control: no-cache
pragma: no-cache
Set-Cookie: PD-S-SESSION-ID=1_2_0_mybaite1MwaXyOPAG+54u+O0H-3p9jREdGrR91vbcRZNhb0h; Path=/; Secure; HttpOnly
Set-Cookie: c2-zolb2-isd-t1-xx-v1-443-ck=rd113o00000000000000000000ffff0a1061ceo20008; path=/


<html>
  <head>
    <title>
Redirection in progress...
              <noscript>
        <style type="text/css">
         body &gt; div { display: none; }
        </style>
      </noscript>
    </title>
  </head>
  <body>
    <div>
      <header>
        <h3>Please wait, while you are being redirected...</h3>
      </header>
    </div>
  </body>
</html>


Johan Haleby

unread,
Mar 23, 2015, 1:08:38 AM3/23/15
to rest-a...@googlegroups.com
So it seems like REST Assured is not following this redirect automatically and I'm quite sure it's for a reason :) If I'm allowed to guess your using a POST? In that case RA is not allowed to follow redirects on 302 responses (as indicated in the blog you mentioned) automatically. You would need to follow the redirect manually. For example:

String location = .. when().post("/xxxx").then().extract().header("Location");
.. when().post(location).then(). .. 

/Johan

Rakesh Prabhakaran

unread,
Mar 23, 2015, 2:37:43 AM3/23/15
to rest-a...@googlegroups.com
Thanks John,

I will test that and  reply. Currently the services are down :P.
Reply all
Reply to author
Forward
0 new messages