You can always recreate "statefulness" by using keys to access a list or map 
of singleton data objects.  Your server object would create/store init'd 
values for use on subsequent calls:

    client.execute("init", ["mykey",x,y,z]);

would be handled as:

    // create new MyObj and associate it w/ "mykey" (if necessary)
    MyObj o = MyObj.getInstance("mykey");
    o.init(x,y,z)

and

    client.execute("doSomething", ["mykey",b]);

would be:

    // get existing MyObj associated w/ "mykey" (exception if doesn't exist)
    MyObj o = MyObj.getInstance("mykey");
    o.doSomething(b);



Of course you'd have to clean-up the map/list occasionally...but there are 
several object pool implementations available for that type of situation.

M



-----Original Message-----
From: Matt Williams [mailto:[EMAIL PROTECTED]
Sent: Friday, June 22, 2007 1:40 AM
To: xmlrpc-dev@ws.apache.org
Subject: Re: Accessing non-static methods

Thanks for the comments & discussion, but I still have the problem.

I tried tweaking the code such that I wasn't calling a method with null
arguments:

My Object is now of the form

MyObj o = new MyObj(x,y,z)

o.doSomething(Boolean b);

I've adapted this to:

client.execute("o.init", [x,y,z])
client.execute ("o.doSomething", [b])

but I'm still getting null errors; all the methods accept and return a
value (although they're ignored), so I suspect the null is due to the
"loss" of the object.

I wonder if this is to do with the "Statelessness" of XML-RPC - I
haven't read the code, but if it is stateless, then there's perhaps no
carry over between the two calls.

Can anyone give any advice on this?

Thanks,

Matt
-- 
http://acl.icnet.uk/~mw
http://adhominem.blogsome.com/
+44 (0)7834 899570

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to