Hello,
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
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver{
private static final String ATTR_KEY="CUSTOM_ATTRIBUTE";
public void
invokeBusinessLogic(org.apache.axis2.context.MessageContext
msgContext, org.apache.axis2.context.MessageContext newMsgContext)
throws org.apache.axis2.AxisFault{
try {
SessionContext sessionContext = msgContext.getSessionContext();
String id=null;
if (sessionContext!=null)
{
id=(String)sessionContext.getProperty(ATTR_KEY);
if (id==null){
id="85";
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:
<serviceGroup>
<service scope="transportsession" name="Echo">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="org.example.www.echo.EchoMessageReceiverInOut"/>
</messageReceivers>
<parameter
name="ServiceClass">org.example.www.echo.EchoSkeleton</parameter>
...
Thanks for your help,
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]