xmlrpc实现php调用api

gongsl 发布于 2014/07/17 11:56
阅读 340
收藏 0

以下是用java调用api来实现login的方法,同样的原理如何通过php在client.php中实现呢?谢谢
public void testADLogin() {

Proxy proxy = null; 
Map<String, String> params = new HashMap<String, String>(); 
params.put("realmId", "12345");   //  id/password 
try { 
proxy = ProxyFactory.createProxy("SimpleFactory"); 
ModifyUser modUser = new ModifyUser("ActiveDirectory","","ADuserid"); 
modUser.assignRealm("12345", null, null); 
proxy.getUpdateSvc().execute(admSession.getSessionToken(), modUser, new HashMap()); 
AuthResultTO result = proxy.getAuthnSvc().login("", "ADuserid", "password", params); 
assertTrue(result.getSession().isAuthenticated()); 
String sessionToken = result.getSession().getSessionToken(); 
} catch (XmlRpcException e) { 
fail(e.code + "," +e.getMessage()); 
} finally { 
proxy.close(); 

如何在client.php中改写成以下方法
function xmlrpcEncodeArgs(/* ... */) { 
$args = array();
foreach(func_get_args() as $n)
array_push($args, php_xmlrpc_encode($n));
return $args;}

加载中
返回顶部
顶部