• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Session maintenance with j2ee generated stub

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to maintain state between a JSE endpoint and a servlet that acts as a client.

Here is the code for the client:


and here is the code for the JSE endpoint:



Here is the output from the console:



As you can see, I have enabled session maintenance and still it does not work. FYI, I use Jboss 4.0.3. Can anyone help please??

Thanks in advance,

Julien.
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int sum = getAdderWebServiceSEIPort().add(4);

Then every time you will create a new stub. You may need to keep it for each httpsession.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Wise Owen,
Thanks for taking the time to reply. I can't figure out what to change in my code in order for it to work. How do I keep the stub for each httpsession? Can you be so kind as to give me a code sample?
Julien.
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In processRequest(...)

...
HttpSession session = request.getSession();

pack.AdderWebServiceSEI ws = session.getAttribute("AdderWebServiceSEI");
if (ws == null) {
ws = getAdderWebServiceSEIPort();
session.setAttribute("AdderWebServiceSEI", ws);
}
....
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot wise owen.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!