Hi, 
 I am using the client service example with soap session enabled, however I am 
not getting the desired results.
I have used the book example of "Quick Start Axis2" where the service code is 
as following.

MessageContext msgContext = MessageContext.getCurrentMessageContext();
        ServiceContext sc = msgContext.getServiceContext();
        
        Object prevValue = sc.getProperty("VALUE");
        
        
        int prevIntValue = 0;
        if(prevValue != null){
            prevIntValue = Integer.parseInt((String)prevValue);
            
        }
        int currentValue = prevIntValue+value;
        sc.setProperty("VALUE", currentValue);
        return currentValue;
    }

and the client code is as following.

ServiceClient sc = new ServiceClient();
        
        sc.engageModule("addressing");        
        
        Options opts = new Options();
        opts.setTo(new 
EndpointReference("http://localhost:8080/axis2/services/WSAddSessionService?wsdl";));
        opts.setAction("urn:add");
        sc.setOptions(opts);
        
        OMElement element = sc.sendReceive(createPayLoad(10));
        System.out.println(element.getFirstElement().getText());
        
        opts.setManageSession(true);
        sc.setOptions(opts);
        element = sc.sendReceive(createPayLoad(10));
        System.out.println(element.getFirstElement().getText());

However when I call the service I get the value 10 every time. Can someone 
kindly suggest what I am missing. In fact I have also changed the services.xml 
as following,

<service name="WSAddSessionService" scope=" soapsession" >

Sardar Hussain




      

Reply via email to