0

I have been trying to maintain user session in a standalone JAX-WS client. The server code is as explained in https://weblogs.java.net/blog/ramapulavarthi/archive/2006/06/maintaining_ses.html.

My problem is with the client. The server does send the JSESSIONID with the response. But it looks like that the client's calls do not send the JSESSIONID with the request(I have tested this on TCPMon). Because of that the server creates a new session every time a request comes.

After some googling I found that I had to set BindingProvider.SESSION_MAINTAIN_PROPERTY = true in request conext in order to maintain user session in client. But sadly this also is NOT working for me.

I have tried generating the stub using AXIS and the session here is being properly maintained. The web service has been deployed in Tomcat.

Thanks.

  • 2
    You shouldn't have sessions when using Webservices. A service should be an independent call to a system. In need for something like a session you can use some context data as header parameters. – lpinto.eu Jul 16 '13 at 11:52
  • Thanks lpinto.eu for your reply... Let me explain it a bit more... The web service I am trying to access has two operations viz. authenticate and getEmployeeDetails... Now the authenticate operation will authenticate the validity of the WS consumer. And the second operation will only work only if the client is authenticated. That is why the session came into picture. Is there a better approach? thanks – user1003920 Jul 16 '13 at 12:12
  • Are you using JAX-WS RI? Or are you using CXF? – Pace Jul 16 '13 at 14:37
  • Take a look at: http://stackoverflow.com/questions/7766811/user-authenticate-in-soap-how-to – lpinto.eu Jul 22 '13 at 11:10

0 Answers0