• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Enabling session tracking in Android application

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic