Andrew,
At first I thank you for your help, and i have again the following
I used the second possibiity ( with SimpleSessionHandler ).
I used the following code in both (client and service) via tcpmon:
MessageContext msgC = MessageContext.getCurrentContext();
String sessionID = msgC.getProperty(SimpleSessionHandler.SESSION_ID).toString();
case 1(code in the service): I got the
java.lang.NullPointerException () by the Response
case 2(code in the client): I got the same Exception by the prompt
remark: I can always see the sessionID bei the header in Response via tcpmon:
(Set-Cookie: JSESSIONID=B5E83885F3A468A6A335E4F619D71596;Path=/axis)
Perhaps i have some errors in my following codes.
Client_____________________________________________
package BrMeinTest;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.namespace.QName;
import org.apache.axis.*;
import org.apache.axis.handlers.SimpleSessionHandler;
import java.net.*;
public class MyTestSessionClient {
public static void main(String [] args) throws Exception {
Service service = new Service();
Call call = (Call)service.createCall();
call.setMaintainSession(true);
String endpoint = "http://localhost:8081/axis/servlet/AxisServlet";
call.setMaintainSession(true);
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName("mySessService","getMySession"));
String retValue = (String)call.invoke(new Object [] {});
MessageContext msgC = MessageContext.getCurrentContext();
String sessionID = msgC.getProperty(SimpleSessionHandler.SESSION_ID).toString();
System.out.println("retValue:"+retValue);
//System.out.println("sessionID:"+sessionID);
}
}
Service _____________________________________________
package BrMeinTest;
import java.util.*;
import org.apache.axis.*;
//import org.apache.axis.transport.http.AxisHttpSession;
import org.apache.axis.session.Session ;
import org.apache.axis.handlers.SimpleSessionHandler;
public class MyTestSessionService {
Session sessionx = MessageContext.getCurrentContext().getSession();
//MessageContext msgC = MessageContext.getCurrentContext();
//String sessionID = msgC.getProperty(SimpleSessionHandler.SESSION_ID).toString();
public String getMySession() {
String retSess = ""+sessionx;
//String retSess = ""+sessionID;
return retSess;
}
}
Thanks again for your help
Bahi
______________________________________________________________________________
FreeMail in der Premiumversion! Mit mehr Speicher, mehr Leistung, mehr
Erlebnis und mehr Pramie. Jetzt unter http://club.web.de/?mc=021105