java - The weird behavior of Apache XML-RPC -


there issue confused me when using apache xml rpc

below code

public class adderimpl implements adder{

private object obj=new string("obj1");  public int add(int pnum1, int pnum2) {      obj="changed";      return pnum1 + pnum2;   }   public object get(){        return this.obj;  } 

}

when call method client side object value still obj1, not "changed"

how can changed value of obj

client:

public class client {

public static void main(string [] args) throws exception {      xmlrpcclientconfigimpl config = new xmlrpcclientconfigimpl();     config.setserverurl(new url("http://127.0.0.1:8080/xmlrpc"));     config.setenabledforextensions(true);       config.setconnectiontimeout(60 * 1000);     config.setreplytimeout(60 * 1000);      xmlrpcclient client = new xmlrpcclient();      client.settransportfactory(             new xmlrpccommonstransportfactory(client));      client.setconfig(config);   // make call using dynamic proxy     clientfactory factory = new clientfactory(client);     adder adder = (adder) factory.newinstance(adder.class);     int sum = adder.add(2, 4);     system.out.println("2 + 4 = " + sum);      system.out.println(adder.get()==null?true:false);      system.out.println(adder.get().tostring());     } 

}

thanks in advance

a new handler get's created each time. obtain behaviour want have following options:

  1. write value database/file (i.e. persistence storage) , read/write there.
  2. make field static, i.e.

    private static object obj=new string("obj1");

hope helps.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -