本文整理匯總了Java中org.apache.xmlrpc.client.XmlRpcClient.execute方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlRpcClient.execute方法的具體用法?Java XmlRpcClient.execute怎麽用?Java XmlRpcClient.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.xmlrpc.client.XmlRpcClient
的用法示例。
在下文中一共展示了XmlRpcClient.execute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerUser
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public boolean registerUser(String user, String password) throws Exception {
XmlRpcClientConfigImpl xmlConfig = new XmlRpcClientConfigImpl();
xmlConfig.setServerURL(new URL(config.getProperty(SYSTEM_XMPP_BACKEND_SERVER_URL)));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(xmlConfig);
Map<String, Object> params = new HashMap<>();
params.put(USER, user);
params.put(PASSWORD, password);
params.put(SERVER, config.getProperty(SYSTEM_XMPP_DOMAIN));
List<Object> register_params = new ArrayList<>();
register_params.add(params);
Object result = client.execute(CREATE_ACCOUNT, register_params);
return true;
}
示例2: testConnection
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
private static boolean testConnection(DemoDbInfo infos) {
// Try to connect to that DB to check it is still available
final XmlRpcClient client = new XmlRpcClient();
final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
try {
String protocolAsString = infos.protocol == RPCProtocol.RPC_HTTP ? "http://" : "https://";
common_config.setServerURL(
new URL(String.format("%s%s:%s/xmlrpc/2/common", protocolAsString, infos.host, infos.port)));
int uid = (int) client.execute(common_config, "authenticate",
new Object[] { infos.db, infos.username, infos.password, new Object[] {} });
// Informations are valid if user could log in.
return uid != 0;
} catch (MalformedURLException e1) {
// Previously saved data is causing this...
// We will have to request a new demo db
return false;
} catch (XmlRpcException e) {
// Connection to previous demo db failed somehow, we will have
// to request a new one...
return false;
}
}
示例3: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
String strUserId = "159a1286-33df-4453-bf80-cff4af0d97b0";
String strFolderName = "folder1";
String strParentId = "null";
Object[] params = new Object[] { strUserId, strFolderName, strParentId};
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.createFolder", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例4: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "-4573748213815439639"};
// strFileId
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.deleteMetadataFile", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例5: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051", "2"};
// strFileId, strVersion
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.restoreMetadata", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例6: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
String[] chunks = new String[] {"1111", "2222", "3333"};
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "test.txt", "", "", "111111", "10", "Text", chunks};
// strFileName, strParentId, strOverwrite, strChecksum, strFileSize,
// strMimetype, strChunks
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.putMetadataFile", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例7: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
String strUserId = "159a1286-33df-4453-bf80-cff4af0d97b0";
String strItemId = "100";
String strIncludeList = "true";
String strIncludeDeleted = "true";
String strIncludeChunks = "true";
String strVersion = "null";
Object[] params = new Object[] { strUserId, strItemId, strIncludeList, strIncludeDeleted, strIncludeChunks, strVersion};
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.getMetadata", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例8: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "hola5", null};
// strFolderName, strParentId
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.putMetadataFolder", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例9: main
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051" };
// strFileId
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.getVersions", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例10: ping
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static String ping(String server) {
try{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(server));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
HashMap<String, String> result = null;
result = (HashMap<String, String>)client.execute("ping", new Object[] {"guest"});
return (String)result.get("ping");
}
catch ( Exception ex ) {
return "Connection failed";
}
}
示例11: executeTests
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public static Object executeTests(String server, Map<String, String> map) {
Object result = null;
try{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(server));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
result = client.execute("executeTestCase", new Object[] {map});
}
catch ( Exception ex ) {
ex.printStackTrace();
}
return result;
}
示例12: execute
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
/**
* Executes an XML RPC method
*
* @param url String
* @param method String
* @return Object
*/
protected Object execute(String url, String method, List<Object> params)
{
Object result = null;
try
{
XmlRpcClient client = getClient(url);
result = client.execute(method, params);
}
catch (XmlRpcException exception)
{
throw new BlogIntegrationRuntimeException("Failed to execute blog action '" + method + "' @ url '" + url + "'", exception);
}
return result;
}
示例13: checkRegistration
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
public Object checkRegistration(String user) throws Exception {
XmlRpcClientConfigImpl xmlConfig = new XmlRpcClientConfigImpl();
xmlConfig.setServerURL(new URL(config.getProperty(SYSTEM_XMPP_BACKEND_SERVER_URL)));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(xmlConfig);
Map<String, Object> params = new HashMap<>();
params.put(USER, user);
params.put(SERVER, config.getProperty(SYSTEM_XMPP_DOMAIN));
List<Object> check_params = new ArrayList<>();
check_params.add(params);
return client.execute(CHECK_USERS_REGISTRATION, check_params);
}
示例14: call
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
protected <X> X call(String username, String password, String path, String methodName, Object... args) {
try {
URL url = new URL(getTestBoot().getSettings().getFathomUrl() + StringUtils.removeStart(path, "/"));
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setBasicUserName(username);
config.setBasicPassword(password);
config.setServerURL(url);
XmlRpcClient xmlrpc = new XmlRpcClient();
xmlrpc.setConfig(config);
Object x = xmlrpc.execute(methodName, args);
return (X) x;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例15: call
import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
@Override
public String call() throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setConnectionTimeout(cm.getXmlrpcMsTimeOut());
config.setGzipCompressing(true);
config.setGzipRequesting(true);
config.setServerURL(cm.getXmlrpcURI());
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object objResult = client.execute(method, params);
String result = "";
if (objResult instanceof String) {
result = (String) objResult;
} else {
result = result + objResult;
}
return result;
}