I figured out that the Cocoa XMLRPC library was already doing the work of parsing out the XMLRPC responses. Basically after you get the XMLRPC response, create a NSDictionary and retrieve the key/value pair. Here's some sample code
//So you could put this in the - (void)viewDidLoad
//URL
NSString *drupalurl = @"http://www.drupalwebsite.com/services/xmlrpc";
//XMLRPC request
XMLRPCRequest *reqUserInfo = [[XMLRPCRequest alloc] initWithHost:[NSURL URLWithString:drupalurl]];
[reqUserInfo setMethod:@"system.connect" withObjects:[NSArray arrayWithObjects: nil]];
XMLRPCResponse *Response = [XMLRPCConnection sendSynchronousXMLRPCRequest:reqUserInfo];
//Whole XMLRPC response dumped into dictionary.
NSMutableDictionary *dict = [Response object];
//Anonymous sessid retrieved from the dictionary
NSString *anonsessid = [dict objectForKey:@"sessid"];
VOILA!!
No comments:
Post a Comment