• Post Reply Bookmark Topic Watch Topic
  • New Topic

session state

 
Pao Biamco
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I need to implement a simple session state but i can't the code looks like :

public java.lang.String authenticate(java.lang.String in0, java.lang.String in1) throws java.rmi.RemoteException {
if ( in0.startsWith("p") && in1.startsWith("r"))
{
System.out.println("-->set session\n");

Session session=MessageContext.getCurrentContext().getSession();
session.set("WSTest","OK");


return "1";
}
else
{
return "0";
}

}

public java.lang.Object[] getUserList() throws java.rmi.RemoteException {

return null;
}


public java.lang.String isAuthenticate(java.lang.String in0) throws java.rmi.RemoteException
{
Session session=MessageContext.getCurrentContext().getSession();


if ( session.get("WSTest") != null )
{
System.out.println("** Session exist\n");
return "1";
}
else
{
System.out.println("** Session NOT exist\n");
return "0";
}

}

...


WSDL:

<service name="WSAuth" provider="java:RPC" style="rpc" use="encoded">
<parameter name="scope" value="session"/>
<parameter name="wsdlTargetNamespace" value="urn:entity.Auth"/>



Client:
System.out.println(service.authenticate("a","b")); // result 0
System.out.println(service.isAuthenticate("a")); // result 0


System.out.println(service.authenticate("p","r")); // result 1
System.out.println(service.isAuthenticate("p")); // result 0

Is there any sample of how to implement session in Axis or webservice ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!