2022

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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.

When a post request is made to DBSync server, the following parameters are verified.

  1. Authentication variable
  2. Profile variable
  3. Payload - Process Definition Language

The following section illustrates how these parameters can be found within DBSync intallation and modify as per to your DBSync and Adapter configurations.

Authentication :

The authentication module verifies your DBSync UserId, Password and Profile used for Integration. The following is a sample DBSync credential which is used for authentication.

Username : Avinash.r@avankia.com
Password : Password
Profile Name : IntacctToDatabase

Profile :

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:\DBSyncIS292". Presuming that DBSync is installed in the default directory, you can find the path of the profile.xml as shown below.

C:\DBSyncIS292\ dbsync2\ WEB-INF\ conf\ db\ <DBSync Username>\ <Profile Name>\ profile.xml


A sample profile.xml file is shown below with configurations of adapters that are used for integration.


<?xml version="1.0" encoding="UTF-8"?>

<!-- DBSYnc User Details -- >

<profile id="avinash.r@avankia.com" name="IntacctToDatabase" loglevel="ALL" email="" guid="0006FBC6">

<!-- Intacct Adapter Configuration -- >

<adapter name="Intacct" type="com.avankia.appmashups.adapter.intacct.IntacctAdapter">
<property name="userid">username</property>
<property name="password" encrypted="true">b0mp03M2WA=</property>
<property name="senderid">avankia</property>
<property name="dtdversion">2.1</property>
<property name="hostUrl">www.intacct.com</property>
<property name="companyid">company-DEV</property>
<property name="controlpassword">YGgH4f267</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">gQkrFAtGxQjkfeVQ==</property>
<property name="url">jdbc:sqlserver://localhost:1433;databaseName=Intacct</property>
<property name="autocommit">true</property>
<property name="driver">sqlserver</property>
<property name="dbname">intacct</property>
<property name="username">sa</property>
</adapter>
</profile>

Payload – Process Definition Language :


The PDL file (Process Definition Language) can be found in the same directory as the profile.xml file or you can also download the PDL file from DBSync. A screenshot below illustrates step-by-step instructions to download the same.

  1. Login to www.mydbsync.com and click on Customer Login tab
  2. Login with the provided DBSync Username & Password
  3. Click on My Home link from the Menu, you will be re-directed to Launch page.
  4. Once into DBSync Home page, Click on Launch button and you will be directed to Profile page in DBSync.
  5. Once inside the profile page, click on Manage --> Edit as shown below. You will be re-directed to Process-Builder page


  • Right-Click on the Process-Definition on the top right hand corner and select Download form the right-click menu as shown.
  • Save the zip file to a desired location and extract the same.

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 Intacct credentials.

Sample Java Code :

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>localhost@avankia.com</userName>" + "<password>localhost</password>" + "<profile>INTACCT</profile>" + "</authentication>";
String profileXML2="";
String profileXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"\+

/*
Intacct Adapter Configuration
*/

"<profile id="localhost@avankia.com" name="INTACCT" loglevel="ALL" email=""guid="01F6CCDC">"+
"<adapter name="Intacct" type="com.avankia.appmashups.adapter.intacct.IntacctAdapter">"+
"<property name="userid">admin</property>"+ // Intacct UserId
"<property name="password" encrypted="true">b0mp03MygWA=</property>"+ //Encrypted Intacct Password
"<property name="senderid">avankia</property>"+  // Intacct SenderId
"<property name="dtdversion">2.1</property>"+   //  Intacct DTD Version
"<property name="hostUrl">www.intacct.com</property>"+  // Host URL
"<property name="companyid">Company-ID</property>"+  // Intacct Company Id
"<property name="controlpassword">YGgH4f3567</property>"\+ // Intacct Control Password
"</adapter>"+


/*
Database Adapter Configuration
*/

"<adapter name="database" type="com.avankia.appmashups.engine.conversion.adapters.DatabaseAdapter">"+
"<property name="password" encrypted="true">HCQpwukG7brzQu3pZW2wjQ==</property>"\+ //Database Password
"<property name="url">jdbc:mysql://localhost:3306/intacct</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.ppend("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);
}
}
  • No labels