I was experimenting with the ServiceLifeCycle in my 181 WS and it would appear
that the session is recreated with every invocation/operation. Perhaps there
is something in a config file that I need to setup. If so then the doc doesn't
mention that fact:
http://labs.jboss.com/portal/jbossws/user-guide/en/html/endpoints.html#service-lifecycle
Here is my code, perhaps I simply built it incorrectly:
| package org.jboss.samples;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.xml.rpc.server.ServiceLifecycle;
| import javax.xml.rpc.server.ServletEndpointContext;
| import javax.xml.rpc.ServiceException;
| import javax.xml.rpc.handler.MessageContext;
| import java.util.Iterator;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Use;
|
|
| @WebService
| @SOAPBinding(style = SOAPBinding.Style.RPC)
| public class ExamineContext implements ServiceLifecycle {
| private ServletEndpointContext context;
|
| @WebMethod (operationName="GetUserPrincipalName")
| public String getUserPrincipalName() {
| return context.getUserPrincipal().getName();
| }
|
| @WebMethod
| public String getAttribute(String key) {
| return (String)
context.getHttpSession().getAttribute(key);
| }
| @WebMethod
| public void setAttribute(String key, String value) {
| context.getHttpSession().setAttribute(key,value);
| }
| @WebMethod
| public void removeAttribute(String key) {
| context.getHttpSession().removeAttribute(key);
| }
| @WebMethod
| public String getSessionId() {
| return context.getHttpSession().getId();
| }
|
| @WebMethod
| public String getMessageContext() {
| MessageContext msgContext = context.getMessageContext();
| StringBuffer sb = new StringBuffer();
| String key = null;
| for(Iterator i = msgContext.getPropertyNames();
i.hasNext(); ) {
| key = (String) i.next();
| sb.append(";" + key + "=" +
msgContext.getProperty(key));
| }
| return sb.toString();
| }
|
| public void init(Object context) throws ServiceException
| {
| System.out.println("ExamineContext Init\n");
| this.context = (ServletEndpointContext)context;
| }
|
| public void destroy()
| {
| System.out.println("ExamineContext Destroy\n");
| }
| }
Burr
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3946723#3946723
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3946723
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user