VOOZH about

URL: https://www.cdata.com/kb/tech/xml-jdbc-runmyprocess.rst

⇱ Connect to XML Data in DigitalSuite Studio through RunMyProcess DSEC


Connect to XML Data in DigitalSuite Studio through RunMyProcess DSEC

πŸ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Use Arkobi Digital's low-code cloud native platform RunMyProcess's DigitalSuite EnterpriseConnect (DSEC) to connect to XML.

The CData JDBC Driver for XML implements JDBC Standards and enables a applications ranging from BI to IDE to connect with XML. In this article, we describe how to connect to XML data from Arkobi Digital RunMyProcess's DSEC and connect to XML in RunMyProcess.

Setting up EnterpriseConnect Agent

Configure the EnterpriseConnect Agent following the EnterpriseConnect page in the RunMyProcess documentation.

Setting up JDBC Adapter

The JDBC Adapter section describes the steps to connect to RDBMS through JDBC. Follow the steps and open the JDBC.config file.

  1. Create a JSON entry for the CData JDBC Driver for XML, e.g.
    XML = {
     "sqlDriver" : "...",
     "sqlSource" : "...",
     "sqlDriverPath" : "..."
    }
    
  2. Set the "sqlDriver" field to the Class name for the CData JDBC Driver, e.g.
    cdata.jdbc.xml.XMLDriver
  3. Set the "sqlSource" field to a JDBC URL for connecting to XML, e.g.
    jdbc:xml:URI=C:/people.xml;DataModel=Relational;

    Built-in Connection String Designer

    For assistance in constructing the JDBC URL, use the connection string designer built into the XML JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

    java -jar cdata.jdbc.xml.jar
    

    Fill in the connection properties and copy the connection string to the clipboard.

    Connecting to Local or Cloud-Stored (Box, Google Drive, Amazon S3, SharePoint) XML Files

    CData Drivers let you work with XML files stored locally and stored in cloud storage services like Box, Amazon S3, Google Drive, or SharePoint, right where they are.

    Setting connection properties for local files

    Set the URI property to local folder path.

    Setting connection properties for files stored in Amazon S3

    To connect to XML file(s) within Amazon S3, set the URI property to the URI of the Bucket and Folder where the intended XML files exist. In addition, at least set these properties:

    • AWSAccessKey: AWS Access Key (username)
    • AWSSecretKey: AWS Secret Key

    Setting connection properties for files stored in Box

    To connect to XML file(s) within Box, set the URI property to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect to Box.

    Dropbox

    To connect to XML file(s) within Dropbox, set the URI proprerty to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect to Dropbox. Either User Account or Service Account can be used to authenticate.

    SharePoint Online (SOAP)

    To connect to XML file(s) within SharePoint with SOAP Schema, set the URI proprerty to the URI of the document library that includes the intended XML file. Set User, Password, and StorageBaseURL.

    SharePoint Online REST

    To connect to XML file(s) within SharePoint with REST Schema, set the URI proprerty to the URI of the document library that includes the intended XML file. StorageBaseURL is optional. If not set, the driver will use the root drive. OAuth is used to authenticate.

    Google Drive

    To connect to XML file(s) within Google Drive, set the URI property to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect and set InitiateOAuth to GETANDREFRESH.

    The property is the controlling property over how your data is represented into tables and toggles the following basic configurations.

    • Document (default): Model a top-level, document view of your XML data. The data provider returns nested elements as aggregates of data.
    • FlattenedDocuments: Implicitly join nested documents and their parents into a single table.
    • Relational: Return individual, related tables from hierarchical data. The tables contain a primary key and a foreign key that links to the parent document.

    See the Modeling XML Data chapter for more information on configuring the relational representation. You will also find the sample data used in the following examples. The data includes entries for people, the cars they own, and various maintenance services performed on those cars.

    πŸ‘ Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)
  4. Set the "sqlDriverPath" field to the name of the CData JDBC Driver JAR file, e.g.
    cdata.jdbc.xml.jar

Sample JDBC.config File

#DBAgent Configuration
XML = {"sqlDriver" : "cdata.jdbc.xml.XMLDriver", "sqlSource" = "jdbc:xml:URI=C:/people.xml;DataModel=Relational;","sqlDriverPath" = "cdata.jdbc.xml.jar" }

Put the JDBC driver JAR file (cdata.jdbc.xml.jar) into the same directory as unified-adapter-[version].jar.

πŸ‘ runmyprocess

Note: Make sure to put the CData license file (cdata.jdbc.xml.lic) into the same directory. Since the license is generated based on the unique identifier of the machine where the product in installed, you will need an offline activation if you want to put the file on another machine.

Starting DigitalSuite EnterpriseConnect Agent

In Windows, start RunMyProcess DigitalSuite EnterpriseConnect Agent in Windows services. To start the application through command line, see Starting the EnterpriseConnect Agent in the RunMyProcess documents.

Starting the JDBC Adapter

Start the JDBC Adapter from runAdapter.bat. Once the Adapter is running, you can access the application through the agent address (e.g. 127.0.0.1:8080). Below is an example executing the command in Windows.

... > java -Djava.util.logging.config.file=./log.properties -cp lib/* org.runmyprocess.sec2.AdapterHandler :
2021-06-09 14:37:58|INFO|correlationId=|Searching for config file...
2021-06-09 14:37:58|INFO|correlationId=|Adapter Handler started with [JDBC] configuration
2021-06-09 14:37:59|INFO|correlationId=|agent address: 127.0.0.1:8080
2021-06-09 14:38:00.251:INFO::ConnectionThread: Logging initialized @1820ms to org.eclipse.jetty.util.log.StdErrLog
2021-06-09 14:38:00|INFO|correlationId=|onConnect() websocket connection between Agent and Adapter established

Once the DigitalSuite EnterpriseConnect Agent and JDBC Adapter are running, access http://localhost:(specified-port-number)/ through your browser to open the page shown below.

πŸ‘ runmyprocess

Check the availability of the JDBC Adapter using tools such as Postman or cURL. Here, we use Postman to send the HTTP POST request.

Configure the RequestHeader as follows:

Content-Type application/json

Configure the RequestBody as follows:

{
	"protocol":"JDBC",
	"data":{
		"DBType":"XML",
		"sqlUsername":"",
		"sqlPassword":"",
		"sqlStatement":"SELECT * FROM people"
	}
}

If the JDBC.config file contains credential information, sqlUsername and sqlPassword can be left empty. If you are not sure of the table name, you can retrieve the list of tables using the request SELECT * FROM sys_tables

The request is successful if the Status is 200 and the Body contains XML data in JSON format.

πŸ‘ runmyprocess

Connect to XML through DSEC Agent in DigitalSuite Studio

Create a DigitalSuite Studio project and then create a Provider in the project.

  • URL: The URL for accessing JDBC Agent (e.g. http:localhost:8080/)
  • Authentication Scheme: Login/password
  • Login: The value from agent.user in the application.properties file
  • Password: agent.password in the application.properties file
  • Secured: Checked
  • Use DigitalSuite EnterpriseConnect: Checked
  • With domain: The value from agent.domain in application.properties file
πŸ‘ runmyprocess

Next, create a Connector in the Provider.

  • Connector URL: Leave this empty
  • Architecture: REST/XML-RPC
  • Method: POST
  • Result format: JSON
  • Accept media type: application/json
  • Character set: Automatic
  • Content: Same as the Request body used in the JDBC Adapter
  • Content type: application/json
πŸ‘ runmyprocess

The JSON data we used as the Request body in JDBC Adapter:

{
	"protocol":"JDBC",
	"data":{
		"DBType":"XML",
		"sqlUsername":"",
		"sqlPassword":"",
		"sqlStatement":"SELECT * FROM people"
	}
}

Open Launch Test to perform the test. The test is successful if XML data is shown in Result on the right pane.

πŸ‘ runmyprocess

Now you can use XML data in RunMyProcess DigitalSuite Studio through DSEC.

For the detailed information on supported SQL commands, refer to the SQL Compliance section in our help documentation. For information on tables, refer to the Data Model section.