config.deployService("sessionTest", service);
AxisServer server = new AxisServer(config);
// Set up the client side (using the WSDD above)
Service svc = new Service(clientProvider);
Call call = (Call)svc.createCall();
svc.setMaintainSession(true);
call.setTransport(new LocalTransport(server));
// Try it - first invocation should return 1.
Integer count = (Integer)call.invoke("sessionTest", "counter", null);
assertNotNull("count was null!", count);
assertEquals("count was wrong", 1, count.intValue());
// Next invocation should return 2, assuming the session-based
// counter is working.
count = (Integer)call.invoke("sessionTest", "counter", null);
assertEquals("count was wrong", 2, count.intValue());
// Now start fresh and confirm a new session
Service svc2 = new Service(clientProvider);
Call call2 = (Call)svc2.createCall();
svc2.setMaintainSession(true);
call2.setTransport(new LocalTransport(server));
// New session should cause us to return 1 again.
count = (Integer)call2.invoke("sessionTest", "counter", null);
assertNotNull("count was null on third call!", count);