• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web service session timeout

 
venu jayaram
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic