I am trying to create contact from my application of java in infusion soft, but failed to get response. sometime i got connection timeout error, sometime got error 596.
My example code is under fellow:
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);
}
}
how do i create a contact in infusion soft using XMLRPC service in java? can i have example code?