I apologize for the very late response.
>> Second, we will cache some user resources in our server business table and we will compile statistics after users end their sessions. In that case, we may need Session_End event. What't more, we use SessionID which from HttpContext to identify a user in Session_End processing. >>
One can always access any database from inside SOEs to store info. However, HTTPContext info is not currently available to SOEs (at 10.1). Its not planned to be supported at 10.2 either.
However, you have access to user name from inside SOEs and if the SOE client shares a session id and session status with the SOE, you could implement this behavior.
Following is a code snippet to retrieve user name:
EnvironmentManager envMgr = new EnvironmentManager();
UID envUID = new UID();
envUID.setValue("{32d4c328-e473-4615-922c-63c108f55e60}");
Object envObj = envMgr.getEnvironment(envUID);
IServerEnvironment2 env2 = new IServerEnvironment2Proxy(envObj);
IServerUserInfo userInfo = env2.getUserInfo();
Hope this helps.
Ajit