[
https://issues.apache.org/jira/browse/AXIS2-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493394
]
Deepal Jayasinghe commented on AXIS2-2607:
------------------------------------------
Hi Glen,
I had a written a session aware sample as you can see below [1] , the sample
worked fine in Axis2 1.1 but when I tried to run the same sample in 1.2 it was
giving error. The issue I found is in the service side we are not setting up
the parent correctly so the logic in the AbstartcContext always returns null
[2].
[1]
public class SampleService4 {
private static String INT_VALUE = "value";
public void init(ServiceContext serviceContext) {
System.out.println("I am inside service init method");
//setting a property
serviceContext.setProperty(INT_VALUE, "0");
}
public void destroy(ServiceContext serviceContext) {
System.out.println("I am inside service destroy ");
}
public int add(int value) {
MessageContext msgctx = MessageContext.getCurrentMessageContext();
String intValue = (String) msgctx.getProperty(INT_VALUE);
int previousValue =0;
if(intValue!=null){
previousValue = Integer.parseInt(intValue);
}
int currentValue = previousValue + value;
msgctx.getServiceContext().setProperty(INT_VALUE, "" + currentValue);
return currentValue;
}
}
[2] -
public Object getProperty(String key) {
Object obj;
obj = properties == null ? null : properties.get(key);
if ((obj == null) && (parent != null)) {
obj = parent.getProperty(key);
}
return obj;
}
I think setting up the parent will fix the issue. I need to look at SVN history
to find out the changes b/w 1.1 and 1.2.
> MessageContext.getProperty does not work correctly
> ---------------------------------------------------
>
> Key: AXIS2-2607
> URL: https://issues.apache.org/jira/browse/AXIS2-2607
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Reporter: Deepal Jayasinghe
> Assigned To: Deepal Jayasinghe
> Priority: Blocker
>
> When I store some property in ServiceContext and try to get that from
> MessageContext it always returns null. When I look at the code I found the
> issue. AFAIK this is a major issue and I think we need to release 1.2.1 with
> the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]