2022
Initiating DBSync integration through Rest-Call
DBSync integration can also be initiated without having to login to www.mydbsync.com. The sync can be initiated from an external application, say with a click of a button or a URL. The following section illustrates how this customization can be achieved.
...
Info | ||
---|---|---|
| ||
Post URL: http(s)://<<server>>:<<port>>/dbsync2cw/dbsyncrestservice.m All post parameters should be UTF-8 encoded. |
...
Username : your_username@company.com
Password : Password
Profile Name : Sage Sage IntacctToDatabase
Code Block |
---|
<authentication> <userName>username@yourcompany.com</userName> <password>your_password</password> <profile>IntacctToDatabase<<profile>Sage Sage IntacctToDatabase</profile> </authentication> |
Profile is basically an XML file and it defines the Business Process to execute. The name of a profile or the xml file is always prefixed with "processdefinition" and usually is in the form of "processdefinition_"<<process_name>>".xml
Profile.xml file stores configuration details of your integration adapters for which you have registered at the time of purchase. The default installation folder of DBSync would be "C:\DBSyncIS292DBSync_Cloudworkflow_x". Presuming that DBSync is installed in the default directory, you can find the path of the profile.xml as shown below.
C:\DBSyncIS292\ dbsync2DBSync_CloudWorkflow_x\CloudWF\WEB-INF\conf\db\<DBSync Username>\<Profile Name>\ profile.xml
A sample profile.xml file is shown below with configuration details of the adapters that are used for integration.
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <!-- DBSync User Details -- > <profile id="your_username@company.com" name="Sage Sage IntacctToDatabase" loglevel="ALL" email="" guid="0006FBC6"> <!-- Sage Sage Intacct Adapter Configuration -- > <adapter name="Sage Sage Intacct" type="com.avankia.appmashups.adapter.intacct.Sage Sage Intacct.Sage Sage IntacctAdapter"> <property name="userid">username</property> <property name="password" encrypted="true">XXXXXX</property> <property name="senderid">avankia</property> <property name="dtdversion">2.1</property> <property name="hostUrl">www.intacctSage Sage Intacct.com</property> <property name="companyid">company-DEV</property> <property name="controlpassword">XXXXXXX</property> </adapter> <adapter name="ConsoleAdapter" type="com.avankia.appmashups.engine.conversion.adapters.ConsoleAdapter" /> <!-- Database Adapter Configuration -- > <adapter name="database" type="com.avankia.appmashups.engine.conversion.adapters.DatabaseAdapter"> <property name="password" encrypted="true">XXXXXX</property> <property name="url">jdbc:sqlserver://localhost:1433;databaseName=Sage Sage Intacct</property> <property name="autocommit">true</property> <property name="driver">sqlserver</property> <property name="dbname">intacct<>Sage Sage Intacct</property> <property name="username">sa</property> </adapter> </profile> |
...
...
The following section shows a Sample Java Code which can be used to make a REST-CALL. The highlighted section shows the modified parameters as per to your DBSync, Database and Sage Sage Intacct credentials.
Sample Java Code :
Code Block |
---|
package com.avankia.appmashups.rest; import java.io.File; import java.net.URLEncoder; import org.apache.commons.io.FileUtils; public class TestClient { public static void main(String[] args) throws Exception { String authenticationXML = "<authentication>" + "<userName>username@company.com</userName>" + "<password>password</password>" + "<profile>IntacctToDatabase<<profile>Sage Sage IntacctToDatabase</profile>" + "</authentication>"; String profileXML2=""; String profileXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"\+ /* Sage Sage Intacct Adapter Configuration */ "<profile id="localhost@avankia.com" name="INTACCTSage Sage Intacct" loglevel="ALL" email=""guid="01F6CCDC">"+ "<adapter name="Sage Sage Intacct" type="com.avankia.appmashups.adapter.intacct.Sage Sage Intacct.Sage Sage IntacctAdapter">"+ "<property name="userid">admin</property>"+ // Sage Sage Intacct UserId "<property name="password" encrypted="true">XXXXXXXXX</property>"+ //Encrypted Sage Sage Intacct Password "<property name="senderid">company</property>"+ // Sage Sage Intacct SenderId "<property name="dtdversion">2.1</property>"+ // Sage Sage Intacct DTD Version "<property name="hostUrl">www.intacctSage Sage Intacct.com</property>"+ // Host URL "<property name="companyid">Company-ID</property>"+ // Sage Sage Intacct Company Id "<property name="controlpassword">YYYYYYYY</property>"\+ // Sage Sage Intacct Control Password "</adapter>"+ /* Database Adapter Configuration */ "<adapter name="database" type="com.avankia.appmashups.engine.conversion.adapters.DatabaseAdapter">"+ "<property name="password" encrypted="true">XXXXXXX</property>"\+ //Database Password "<property name="url">jdbc:mysql://localhost:3306/yourdb</property>"+ // Database Connection String "<property name="autocommit">true</property>"+ "<property name="driver">mysql</property>"+ // Database Driver "<property name="dbname">mysql</property>"+ "<property name="username">root</property>"+ // Database User "</adapter>"+ "</profile>"; \\ StringBuilder content = new StringBuilder(); content.append("authenticationXML="); content.append(URLEncoder.encode(authenticationXML, "UTF-8")); content.append("&"); content.append("profileXML="); content.append(URLEncoder.encode(profileXML, "UTF-8")); content.append("&"); content.append("payload=processdefinition_testpdl.xml"); String response = Http.post("http://localhost:8080/dbsync2/dbsyncrestservice.m", content.toString(), "application/x-www-form-urlencoded"); System.out.println("HTTP Response:\n"+response); } } |
...