axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin TierOne" <>
Subject scope=transportsession, new SessionContext instance for each request
Date Thu, 20 Mar 2008 16:21:25 GMT

I am trying to work out a very simple example with
scope=transportsession.  The purpose of this exercise is to save an
attribute on the session for use when the server receives several
requests from the same client.

The following code returns a different SessionContext instance every
time the service is called.  Thus when I use session.getProperty(),
null is always returned even if I have called setProperty() in a
previous request.

        public class EchoMessageReceiverInOut extends

        private static final String ATTR_KEY="CUSTOM_ATTRIBUTE";
        public void
msgContext, org.apache.axis2.context.MessageContext newMsgContext)
        throws org.apache.axis2.AxisFault{

        try {

        SessionContext sessionContext = msgContext.getSessionContext();

        String id=null;
        if (sessionContext!=null)
          if (id==null){
            sessionContext.setProperty(ATTR_KEY, id);

        // get the implementation class for the Web Service
        Object obj = getTheImplementationObject(msgContext);

Is there any other configuration that I am required to add, possibly
on the client side?

Is there another (better) way to save an attribute for the session?

I'm using axis2-1.3 (latest release) and tomcat 5.5.

This is what my service.xml looks like:

    <service scope="transportsession" name="Echo">
            <messageReceiver mep=""

Thanks for your help,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message