2016-05-10 6 views
0

Javaのアプリケーションを注入ソフトで連絡先を作成しようとしていますが、応答に失敗しました。いつか私は、接続タイムアウトエラーが発生しました、いつかエラー596Javaでxml rpcサービスを使用してinfusionsoftで連絡先を作成するにはどうすればよいですか?

は私のコード例は、仲間の下にありました:

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\", \"[email protected]\"); 

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サービスを使用して点滴で連絡先を作成するのですか?私はコード例がありますか?

答えて

0

これは、注入ソフトで連絡先を作成する完全なコードです。

キー:キーparametterアカウント

URLの作成中にソフト注入によって秘密鍵である:「https://myApp.infusionsoft.com:443/api/xmlrpcは」、「て、myApp」の代わりにアプリの名前を記述する必要があります。

public static void addContact() { 
     try { 
      //Sets up the java client, including the api url 
      XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 
      config.setServerURL(new URL("https://myApp.infusionsoft.com:443/api/xmlrpc")); 
      XmlRpcClient client = new XmlRpcClient(); 
      client.setConfig(config); 

      //The secure encryption key 
      String key = "34534k34h5k34hj34k5hhk"; 

      /** 
      * *********************************************** 
      *            * 
      * ADD CONTACT TO DATABASE * 
      * *********************************************** 
      */ 
      List parameters = new ArrayList(); 
      Map contactData = new HashMap(); 
      contactData.put("FirstName", "Java John"); 
      contactData.put("LastName", "Doe"); 
      contactData.put("Email", "[email protected]"); 

      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); 
     } 
    } 

3日を過ごした後、完全な作業コードです。解決策を得ることができます。

関連する問題