axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kutschera Peter <Peter.Kutsch...@arcs.ac.at>
Subject AW: AW: Going nuts - Can't get Session to work !
Date Mon, 14 Apr 2003 10:41:06 GMT
The Scope parameter determines the livetime of the service Object.
Normally (Scope=request) for each request an Object is created ant thrown
away.
For scope=Application Only one Object is created to serve all requests.
For scope=session for each session an Object (instance) of your server class
created.


If you set up the service with
 <parameter name="scope" value="session" />
  in deploy.wsdd

AND the client calls 
  ((org.apache.axis.client.Stub)misc).setMaintainSession(true);

You can use instance variables to keep your server data.

But maybe by english is not good enough :-(

Hope this helps.
Do you need an example?

 Peter

-----Urspr√ľngliche Nachricht-----
Von: Zac Tolley [mailto:zac@exsiteconsultants.com] 
Gesendet: Montag, 14. April 2003 12:31
An: axis-user@ws.apache.org
Betreff: Re: AW: Going nuts - Can't get Session to work !


???????????



On Monday, April 14, 2003, at 11:28 AM, Kutschera Peter wrote:

> Interesting server.
> Since the livetime of the server object is session I use instance
> variables
> to keep my data.
>
> Peter--
> Dipl.-Ing. Peter Kutschera
> Peter.Kutschera@arcs.ac.at
> tel:+43 50550 3151
>
> -----Urspr√ľngliche Nachricht-----
> Von: Zac Tolley [mailto:zac@exsiteconsultants.com]
> Gesendet: Montag, 14. April 2003 11:45
> An: axis-user@ws.apache.org
> Betreff: Going nuts - Can't get Session to work !
>
>
>
> I swear I am going nuts.
>
> This is what I do.
>
> 1. Create a simple class.
>
> package com.zt.guaserver;
> import org.apache.axis.MessageContext;
> import org.apache.axis.session.*;
> import java.util.*;
>
> public class Misc {
>
> 	public void Logon(String userid, String password) throws Exception
> {		Session session =
> MessageContext.getCurrentContext().getSession();
>          	session.set("userid", userid);
>          	session.set("password", password);
> 		return;
> 	}
>
> 	public String getSessionVars() throws Exception	{
> 		StringBuffer result = new StringBuffer();
> 		org.apache.axis.session.SimpleSession session=null;
> 		session = 
> (org.apache.axis.session.SimpleSession)MessageContext.getCurrentContex
> t
> (
> ).getSession();
>          	
> 		if(session == null)	return "No Session";
>
> 		for (Enumeration e = session.getKeys();e.hasMoreElements();)
> {
>          		String key = (String)e.nextElement();
>          		result.append(key + "=");
>          		result.append( (String)session.get(key) );
>          	}
>
>          return result.toString();
>
>      }
> }
>
> 2. I created a deployment file and ran the deployment class.
>
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> 	
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 	
> 	<handler name="session" 
> type="java:org.apache.axis.handlers.SimpleSessionHandler" />
> 	<service name="GUA_Misc" provider="java:RPC">
> 		<requestFlow><handler type="session"/></requestFlow>
>         		<responseFlow><handler
type="session"/></responseFlow>
>
>    		<parameter name="className" value="com.zt.guaserver.Misc"/>
> 		<parameter name="allowedMethods" value="*"/>
> 		<parameter name="scope" value="session"/>
> 	</service>	
> </deployment>
>
> 3. Then I ran Java2WSDL with default settings and WSDLtoJava
>
> 4. I created a client app that contains
> 		MiscService miscservice = new MiscServiceLocator();
> 		Misc misc = miscservice.getGUA_Misc();
> 	
> ((org.apache.axis.client.Stub)misc).setMaintainSession(true);
> 	
> 		misc.logon("ztolley","password");	
> 		System.out.println(misc.getSessionVars());
>
> When I run this the client does not appear to sent up a sessionid in 
> the second request.
>
> What do I have to do to make the client see the sessionid that has 
> been returned to it and send it back?
>

Mime
View raw message