XMLRPCRequest * request = [[XMLRPCRequest alloc] initWithURL:[NSURL URLWithString:server_url]];
NSArray *param=[NSArray arrayWithObjects:@"demoDB",user_id,password, nil];
[request setMethod:@"user_data" withParameters:param];
XMLRPCConnectionManager *manager = [XMLRPCConnectionManager sharedManager];
XMLRPCResponse * response = [XMLRPCConnection sendSynchronousXMLRPCRequest:request error:nil];
NSString* result = [response body];
NSLog(@"%@",result);
if ([response faultCode]==0)
{
NSDictionary *xmlDoc = [NSDictionary dictionaryWithXMLString:result];
NSLog(@"%@",xmlDoc);
}else
{
NSString* error = @"error";
NSLog(@"%@",error);
}
服务器端代码
$ url =“http://www.someurl.com:8069”;
$ db =“demoDB”;
$ email =“someid @ ---”;
$ password =“******”;
require_once( '拉索-1.1 / ripcord.php');
$ common = ripcord :: client(“$ url / xmlrpc / 2 / common”);
$ uid = $ common-> authenticate($ db,$ email,$ password,array());
$ models = ripcord :: client(“$ url / xmlrpc / 2 / object”);
如果($ UID) {
#first load username
$user_data = $models->execute_kw($db, $uid, $password,
'res.users', 'read',
array($uid),
array('fields'=>array('name', 'company_id')));
否则
{
echo "failed";
}
答案 0 :(得分:1)
试试这个例子可能对你有所帮助
使用xml解析在iOS中调用SOAP webservice http://www.jogendra.com/2015/03/soap-webservice-calling-in-ios-with-xml.html