我正在尝试从我在 infusion soft 中的 java 应用程序创建联系人,但未能得到响应。有时我收到连接超时错误,有时收到错误 596。
我的示例代码在同伴之下:
public static void addContact() {
try {
//Sets up the java client, including the api url
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setConnectionTimeout(60 * 1000);
config.setReplyTimeout(60 * 1000);
config.setServerURL(new URL(\"https://api.infusionsoft.com/\"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
//The secure encryption key
String key = \"sdfsdfsdfsdfs34534534534534\";
/**
* ***********************************************
* *
* ADD CONTACT TO DATABASE *
* ***********************************************
*/
List parameters = new ArrayList();
Map contactData = new HashMap();
contactData.put(\"FirstName\", \"Java John\");
contactData.put(\"LastName\", \"Doe\");
contactData.put(\"Email\", \"john@doe.com\");
parameters.add(key); //The secure key
//parameters.add(\"Contact\"); //The table we will be adding to
parameters.add(contactData); //The data to be added
//Make the call
Integer contactId = (Integer) client.execute(\"ContactService.add\", parameters);
System.out.println(\"Contact added was \" + contactId);
} catch (MalformedURLException ex) {
System.out.println(ex);
} catch (XmlRpcException ex) {
System.out.println(ex);
}
}
如何在 Java 中使用 XMLRPC 服务在输液软件中创建联系人?我可以有示例代码吗?