gusmueller
Thursday, December 5th, 2002

Wow. This is my 700th post.
Neat.

Anyway, I think I came up with a decent solution to being able to do xml-rpc a bit more smoothly in
Cocoa - I created a class called "XMLRPCServer" which has a couple of methods like:

-(id)call:(NSString *)method withArg:(id)arg;
-(id)call:(NSString *)method withArg1:(id)arg1 withArg2:(id)arg2;


... and so on.

So now I can make calls with a bit more ease like this:

XMLRPCServer *server = [XMLRPCServer serverWithURL:@"http://betty.userland.com/RPC2" handler:@"examples"];
NSString *state; = [server call:@"getStateName" withArg:[NSNumber numberWithInt:5]];


Which isn't too shabby.

I also added a method that'll call the xmlrpc server asynchronously... you just set a callback method and bang- it all works.

Cool, and close enough dangit.

I gotta make sure I don't have any memory leaks in it, and then I'll post up an example app showing this guy.

comments (0)   # posted 6:48 pm (uct-6)


I'm amazed at how easy it is to do xmlrpc in Python.

import xmlrpclib
server = xmlrpclib.Server('http://betty.userland.com/RPC2');
print server.examples.getStateName(34)

and that's it. I wonder if such a thing could be done for objective-c. A way to call methods with arguments that don't really exist in a class...

Server *server = [[Server alloc] initWithUrl:@"http://betty.userland.com/RPC2" andHandler:@"examples"];
NSString *state = [server getStateName:5];

... oh that would be sweet.

comments (0)   # posted 1:20 pm (uct-6)