Hi, I have coded by the following webservice and deployed using Axis engine and Tomcat webserver. The webservice I deployed has the following structure
package noniaxisws;
public class DipsoProjectWSSoapBindingImpl implements noniaxisws.HelloAxisAnt{ private int x; private int y; private int s; public int sum() throws java.rmi.RemoteException { s=x+y; return s; }
public java.lang.String getMessage() throws java.rmi.RemoteException { return "The sum of x+y= "+s; }
public void assign() throws java.rmi.RemoteException { x=10; y=20; }
}
The client of the webservice is given below public class ClientMain {
/** Creates a new instance of ClientMain */ public ClientMain() { }
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String outputString="Failed to use Web Service"; try{ String endpoint="http://localhost:8080/axis/services/DipsoProjectWS"; Service service=new Service(); DipsoProjectWSSoapBindingStub wsstub=new DipsoProjectWSSoapBindingStub(new URL(endpoint), service);
The problem I am facing currently is Though I have initialised the private member X and Y using assign method. The result of the sum methods is performed next and the results are printed out. But the result seems to x+y=0; Why is the value of x and y is not assigned in the function assign. How to achieve sharing of data through private variable between different functions deployed as webservices?.