Two Laptop Bag*
The moose likes Web Services and the fly likes Web service session timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web service session timeout" Watch "Web service session timeout" New topic
Author

Web service session timeout

venu jayaram
Greenhorn

Joined: Mar 11, 2008
Posts: 27
Hi,

I want know how to make session time out in web service.

I using Axis2 web service. in this we can manage the session in 4 type's
Request,SOAPSession,Application,Transport.

this is the following program that session management but i don't how to give session time out. in this program until the system shot down session is existing. please i want make 30sec session time out please tell me how to do this.....where i need to mention the session time out........




/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Test;

import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.service.Lifecycle;

/**
*
* @author Admin
*/
public class Myservice implements Lifecycle {

/** Sample method
*/
private static ServiceContext sc;
public void init(ServiceContext context) throws AxisFault {
System.out.println("welcome");
sc = context;
sc.setProperty("last", 0);
}

public void destroy(ServiceContext context) {
}

public int add(int value) {
int currentValue = value +(Integer)sc.getProperty("last");
sc.setProperty("last", currentValue);
return currentValue;
}

}



Thanks and Regards
Venu J
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Why don't you manage session timeout using web.xml? By the way web services are supposed to stateless (not necessary) hence they should not be worried about session.


My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web service session timeout
 
Similar Threads
Please improve my code/approach.
Mapping qname not fond for the package: org.hibernate.collection
ERROR in WebService AXIS2
Web Services problem
Help with simple Recursive functions