Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enabling session tracking in Android application

 
yevgeny lvovski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I'm now developing my first Android application.
My application interacts with a web service using SOAP messages (JAX-WS). The web service sits in glassfish4 server.
So I want that every user that interacts with the web service will get a new instance of the class that represents the web service.
I read that I need to add the @HttpSessionScope annotation to the web service class.
But what should I write on the client side, in the android application to enable the session tracking?

If it was a regular application than all I needed to do is to add ((BindingProvider)proxy).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,true);
to the application, but in android application I have no idea how to do this.

hope someone can help me.
thanks
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sessions are generally not used with WS. What do you hope to gain by using them?
 
yevgeny lvovski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's a game, similar to tic tac toe.
when the first user starts to play, he send a message to the webservice that creates a new entry in the database table for the new game, and than the user waits until some second player joins the game.
when the second player wants to join- he sends a message to the webservice that checks if there is an entery in the database for a game , if there is an entry - he updates the entry (so the first player knows that the second one joined the game) and the game started.

so lets say a player interacts with the web service to update his move to the database, the web service needs to know the user game's id so it can update the move in the right game.
so game id is one of the values that I want to save for each user.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client would usually send some kind of ID (the player ID, maybe) along with the WS call, so that the server-side could then look up everything related to that ID - either from the DB, or some cache in front of the DB. But the cache should be independent of the client (which would differentiate it from a session).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic