Skip to Content

Connector tutorial scenario 4: Process file

Introduction

This scenario demonstrates the use of a Dropbox Process File activity.

In this scenario, an XML file is fetched from Dropbox and then written to an FTP server as a JSON file.

Note

Similar to Scenario 1: Fetch file, the file is processed based on an XSD that is specified in the configuration of the activity in Integration Studio.

Here is the completed operation:

image

Important

To complete this operation and scenario, complete the prerequisite setup required in the Dropbox connector tutorial.

You should have the following:

  • Access to a Dropbox account and FTP server.
  • Configured Dropbox and FTP connectors.
  • Access to assets/sample-data directory of the Dropbox connector repository.

1. Copy sample files to Dropbox

Copy the three sample files (account.xml, company.xml, and customer.xml) from the assets/sample-data directory of the Dropbox connector to your Dropbox account.

2. Add a Dropbox Process File activity to an operation

Drag a Dropbox Process File activity type from the component palette to a new operation on the design canvas.

Enter a name, a folder path (such as /), and the name of the file to be downloaded (such as account.json):

image

Click Next to go to the next step.

With the Dropbox Process File activity, we are demonstrating the ability of a connector to dynamically configure the schema based on a user selection.

The schemas available are included in the connector at build time, but a connector could dynamically refresh the list and available connectors.

Select the account row, as that will use the XSD associated with the account XML file:

image

Click Next to review the data schema, showing that the response from Dropbox will be an account object and its fields.

At this point, you can go back to the previous screen and try selecting the other object types to see how the data schema changes to reflect the chosen object.

When finished, make sure that you have selected the account object, as that will be required for the rest of the tutorial:

image

Click Finished to close the activity configuration.

3. Add an FTP Write activity to the operation

Drag a FTP Write activity from the design component palette to the component drop zone on the design canvas to create an instance of a FTP Write activity in a new operation. Double-click the activity to open it.

Configure it with a name, a path (such as /), and an appropriate file name (such as account.json or, for a date-stamped file name, dropbox_process_results_[date]_[time].json).

You will need to specify a schema for the activity. The simplest way is to provide the desired output file as a sample schema. Select Yes, provide new schema:

image

You can provide the schema in a number of ways: loading a URL, uploading a file, or typing or pasting directly in the editor:

  • You can provide a URL; the account.json file is available at https://raw.githubusercontent.com/jitterbit/dropbox-connector/master/assets/sample-data/account.json.

    image

  • You can also upload a file directly; the account.json file is included in the assets/sample-data directory:

    image

  • You can also type or paste directly into the schema editor.

When complete, the activity configuration should be similar to this:

image

Click Next and then Finished to return to the workflow.

4. Add a transformation to the operation

Add a transformation between the two activities.

When it opens, give the transformation a name and use Automap Exact Matches to complete the transformation mapping.

If an appropriate schema was provided, all fields will automatically be mapped and the target (right) schema will indicate that the schema is JSON by the labeling of the root node.

Click the Close icon to save the transformation configuration and return to the workflow:

image

5. Run the operation

Deploy and run the operation. The sample file should be retrieved from Dropbox, processed into a JSON format, and then placed on the FTP server.

In the operation log, you should see a log message that the operation was successfully completed. On the FTP server, you should find that a copy of the file with the correct schema:

image