1. There is a class called MyService which is INT K;
This class provides a service called
ADD1 () {k ;}
There is also a service called int GETK () {
Return K;}
I hope to call Add1 () twice on the client, then getk (), the result of returning, I thought it would be 2
However, the result of his returned is 0, I don't understand, don't I call the server method each time it regenerates this class? /// Your problem is simple. Because AXIS default scope properties are called by Request mode, that is, every call is created a new MyService object, handle your method, which will of course return 0. If you set Scope to session or Application, it is possible to create an object for each session. Application refers to a unique object for the entire app. The two conditions behind this must consider the problem of thread synchronization (Axis will not synchronize for you), that is, if there are more than two clients simultaneously call the add1 () method, K's value may not What you think.
Below is the code: Service service = new service (); call call = (call) service.createCall (); call.setProperty ("scope", "session"); // This can be session or ApplicationService.setMainTainSession (True) ;
Forgot this sentence! Your Client side must specify it. As follows: service service = new service (); service.setMainTainSession (true); call call = (call) service.createcall ();