axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akira Hirose <Akira.Hir...@fujixerox.co.jp>
Subject deploy problem. <parameter name="scope" value="session"/> would not work.
Date Fri, 08 Mar 2002 06:39:50 GMT
Hello,

 I tried to make the life span of a SOAP service object session wide 
without success. I wrote a test service and a test client. If parameter
scope is "application" or "request", it works as I expected. But, when
scope is "session", test program behaves the same way when scope is request.

 Would you mind tell me what is wrong. Or am I misunderstanding the
meaning of "session" scope? I appreciate any advice.


version:

Axis-beta1-RC1, Apache Tomcat 4.0.1, JDK 1.3.1_01
Windows NT 4.0 SP6.
Both service and client are running on identical machine.
 
Detail:

My test service is a Java class  LifeSpanTest which has an integer 
variable and a getNext method which increment the variable and return 
the value. 
The client program Test.java repeats making getNext successive call to 
the service. When the LifeSpaceTest service is deployed with scope 
parameter "application", the client gives following result as I expected.

	clear
	test start
	(1): 1
	(2): 2
	test end
	test start
	(1): 3
	(2): 4
	test end

and, if scope is "request", it gives following result as I expected.

	clear
	test start
	(1): 1
	(2): 1
	test end
	test start
	(1): 1
	(2): 1
	test end

When I set scope "session", I expected,

	clear
	test start
	(1): 1
	(2): 2
	test end
	test start
	(1): 1
	(2): 2
	test end

But, result was.

	clear
	test start
	(1): 1
	(2): 1
	test end
	test start
	(1): 1
	(2): 1
	test end

Source code of the service LifeSpanTest.java, the deploy.wsdd, 
and the test client Test1.java is below.

/* Test life span of a SOAP service object. */

public class LifeSpanTest {
	
	private int	counter;
	
	public LifeSpanTest() { counter = 0; };
	
	public int clear() { counter = 0; return counter; }
	
	public int getNext() { counter++; return counter; }
	

}

<deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

  <!-- Services from LifeSpanTest WSDL service -->

  <service name="LifeSpanTest" provider="java:RPC">
      <parameter name="className" value="LifeSpanTest"/>
      <parameter name="methodName" value="*"/>
<!--
      <parameter name="scope" value="application"/>
      <parameter name="scope" value="session"/>
      <parameter name="scope" value="request"/>
-->
      <parameter name="scope" value="session"/>
  </service>
</deployment>


/* Client */

package localhost;


public class Test1 {
	
	private static void clear() {
		try {
			int i;
			LifeSpanTestService  locator = new LifeSpanTestServiceLocator();
			LifeSpanTest svc = locator.getLifeSpanTest();
			System.out.println("clear");
			i = svc.clear();
		} catch ( Exception e ) {
			System.err.print(e);
		}
	}
	
	private static void test() {
		try {
			int i;
			LifeSpanTestService  locator = new LifeSpanTestServiceLocator();
			LifeSpanTest svc = locator.getLifeSpanTest();
			System.out.println("test start");
			System.out.println("(1): "+ String.valueOf(svc.getNext()) );
			System.out.println("(2): "+ String.valueOf(svc.getNext()) );
			System.out.println("test end");
		} catch ( Exception e ) {
			System.err.print(e);
		}
	}

	public static void main(String [] args) throws Exception {
		clear();
		test();
		test();
	}
}


 Thank you.

/* akira.hirose */

Mime
View raw message