Contact Us 1-800-596-4880

FTPS Connector

Anypoint Partner Manager V1.0 was deprecated in March 2021. Its End of Life is March 31, 2022. Support for Anypoint Partner Manager 1.0 continues in accordance with the Product Support and Maintenance Terms but is not available for new customers or upgrades. For the latest version of Anypoint Partner Manager, contact your Customer Success Manager to determine how you can migrate to the current version.

Premium

The Anypoint Connector for FTPS allows you to send and receive files over FTPS, enabling seamless integration between Mule applications and an FTPS server, using Mule runtime.

This guide helps you understand how to set up and configure a basic Mule flow with the FTPS connector.

Prerequisites

This document assumes that you are familiar with FTPS, Mule, Anypoint connectors, Anypoint Studio, elements in a Mule flow, and global elements.

Hardware and Software Requirements

Compatibility

Application/Service Version

Mule Runtime

3.7.0 and later

Install the FTPS Connector

  1. In Anypoint Studio, click the Exchange icon in the Studio task bar.

  2. Click Login in Anypoint Exchange and supply your Anypoint Platform username and password.

  3. Search for the FTPS connector and click Install.

  4. Follow the prompts to install the connector.

Configure the FTPS Connector Global Element

You can configure a global element for the FTPS connector for use by multiple instances of the FTPS connector in your application. However, not all connector instances use the same global element or configuration, and it is not uncommon to have multiple connectors in a flow, using different global elements or configurations to connect to one or different instances.

You can provide connection and other details in the Global Element Properties window. These settings are saved in a global element and referenced by applicable connector instances.

Placeholder values refer to values saved in a .properties file, which exists by default in the src/main/resources folder of your project (See Configuring Properties).

For easy maintenance and re-usability of your connector properties, we recommend that you use a .properties file. Avoid hard coding these values in the global element if you need to deploy the app to different environments, such as production, development, and QA, where your access credentials might differ. For more, see Deploying to Multiple Environments.

Global Element Properties for FTPS Connector

Field Description

Username

The username of the user’s login on the FTPS server - if the server allows anonymous login, you can use 'anonymous' as the username.

Password

The password to be used for login. For anonymous login, this field can be empty.

Host

The host address of the FTPS server.

Port

The port where the FTPS service is running.

Keystore path

Path to the keystore to be used for SSL.

Keystore password

The password for the keystore file.

Read timeout

Specifies the amount of time in milliseconds that the consumer waits for a response before it times out. The default value is 0, which means infinite.

Connection timeout

Specifies the amount of time in milliseconds that the consumer attempts to establish a connection before it times out. The default value is 0, which means infinite.

Disable Certificate Validation

Disable SSL certificate validation, to ignore the certificates to be used, and use Trust all policy - This is not recommended.

Encryption mode

Specifies how to invoke client security - IMPLICIT or EXPLICIT.

Transfer mode

Specifies how the data connection is established - PASSIVE or ACTIVE.

Using the FTPS Connector

A FTPS connector is based on the concept of the endpoint. The global element can be configured either as an:

  • Inbound endpoint to read files from a FTPS server.

  • Outbound connector to upload a file to a FTPS server.

Connector Namespace and Schema

When designing your application in Studio, when you draft the connector from the palette on to the Anypoint Studio canvas, Studio automatically populates the Mule application’s XML code with the connector namespace and schema location.

Namespace:

xmlns:ftps="http://www.mulesoft.org/schema/mule/ftps"

Schema Location:

http://www.mulesoft.org/schema/mule/ftps http://www.mulesoft.org/schema/mule/ftps/current/mule-ftps.xsd

If you are manually coding the Mule application in Studio’s XML editor or other text editor, define the namespace and schema location in the header of your Configuration XML, inside the <mule> tag.

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ftps="http://www.mulesoft.org/schema/mule/ftps"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/ftps
	       http://www.mulesoft.org/schema/mule/ftps/current/mule-ftps.xsd">

      <!-- put your global configuration elements and flows here -->

</mule>

Using the Connector in a Mavenized Mule App

If you are coding a Mavenized Mule application, include this XML snippet in your pom.xml file.

<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-ftps-transport</artifactId>
  <version>1.0.0</version>
</dependency>

Inside the <version> tags, put the current version number. The current version is: 1.0.0.

FTPS Connector Example Use Cases

The example use case walkthroughs are geared toward Anypoint Studio users. For those writing and configuring the application in XML, jump straight to the example Mule application XML code to Read files or Write file to see how the FTPS global element and the connector are configured in the XML in each use case.

Read Files from an FTPS Server and Log File Content - Studio

  1. In Studio, create a new Mule Project by clicking File > New > Mule Project.

  2. With your project open, search the Studio palette for the FTPS connector you should have already installed. Drag and drop a new FTPS connector onto the canvas.

  3. Drag and drop a Logger after the FTPS element to log incoming messages in the console.

  4. Double click the flow header and rename it to be read-flow.

  5. Double click the FTPS connector element, and configure its properties as follows:

    Field Value

    Display Name

    FTPS (Streaming)

    Consumer Configuration

    "FTPS_Basic_config" (default name of a configuration, or any other configuration that you configured as explained in the Configuration section.

    Operation

    Read

    Directory to move to

    The directory where to move the files after they are read from the server. If left empty, the files are deleted.

    File name

    File name pattern for the files to be read.

    Maximum concurrent reads

    The number of threads (connections) to use to read files.

    ASCII Data Type

    Whether the files to be read are in ASCII or BINARY - the default is BINARY.

    Streaming

    Whether to send an InputStream as the message payload (if true) or as a byte array (if false). The default is false.

    Pooling period

    The interval to query the server for files.

  6. Select the logger and set its fields as follows:

  7. Deploy the app on Studio’s embedded Mule Runtime (Run As > Mule Application). When a new file matching your file name pattern appears, you should see its content logged in the console.

Read Files from an FTPS Server - XML

Run this Mule application featuring the connector as a consumer using the full XML code that would be generated by the Studio work you did in the previous section:

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

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
	xmlns:ftps="http://www.mulesoft.org/schema/mule/ftps"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-current.xsd
	http://www.mulesoft.org/schema/mule/core
	http://www.mulesoft.org/schema/mule/core/current/mule.xsd
	http://www.mulesoft.org/schema/mule/ftps
	http://www.mulesoft.org/schema/mule/ftps/current/mule-ftps.xsd
	http://www.mulesoft.org/schema/mule/ee/tracking
	http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    <ftps:config name="FTPS_Basic_Config" username="${username}" password="${password}"
    host="${host}" port="${port}" disableCertificateValidation="true" doc:name="FTPS: FTPS Basic Config"/>
    <flow name="read-flow">
        <ftps:read config-ref="FTPS_Basic_Config" fileName="test_read*" filesPath="/files"
	pollingPeriod="10000" doc:name="FTPS (Streaming)" isASCII="true"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

Write Files to an FTPS Server - Studio

  1. Create a new Mule Project by clicking File > New > Mule Project.

  2. Navigate through the project’s structure and double-click src/main/app/project-name.xml.

  3. Drag and drop a new HTTP element onto the canvas. This element is the entry point for the flow and provides data to be written in a file.

  4. Drag and drop a new FTPS element after the HTTP Listener.

  5. Double click the flow header (blue line) and change the name of the flow to "write-flow".

  6. Select the HTTP element.

  7. Click the plus sign next to the Connector Configuration dropdown.

  8. A pop-up appears, accept the default configurations and click OK.

  9. Set Path to write.

  10. Select the FTPS connector and set its properties as follows:

    Display Name Write

    Consumer Configuration

    "FTPS_Basic_config" (default name of a configuration, or any other configuration that you configured as explained in Configure the FTPS Connector Global Element section).

    Operation

    Write

    File Name

    The name of the file to be created on the FTPS server.

    File Path

    The path on the FTPS server where the file is created.

    Input Reference

    The data to be written in the given file.

    ASCII Data Type

    Whether the files to be read are ASCII or BINARY - the default is BINARY.

    Append Contents

    True if you want to append the contents passed to the operation to an existing file.

    Streaming

    Whether to upload the contents of the file as a stream or all at once.

  11. Start the application and invoke the HTTP endpoint that you created so the new file is created on the FTPS server.

Write Files to an FTPS Server - XML

Run this application featuring the connector as a message publisher using the full XML code that is generated by the previous Studio sections:

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

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
	xmlns:ftps="http://www.mulesoft.org/schema/mule/ftps"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-current.xsd
	http://www.mulesoft.org/schema/mule/core
	http://www.mulesoft.org/schema/mule/core/current/mule.xsd
	http://www.mulesoft.org/schema/mule/ftps
	http://www.mulesoft.org/schema/mule/ftps/current/mule-ftps.xsd
	http://www.mulesoft.org/schema/mule/ee/tracking
	http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
	http://www.mulesoft.org/schema/mule/http
	http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
    <ftps:config name="FTPS_Basic_Config" username="${username}" password="${password}"
    host="${host}" port="${port}" disableCertificateValidation="true" doc:name="FTPS: FTPS Basic Config"/>
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081"
    doc:name="HTTP Listener Configuration"/>
    <flow name="write-flow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <ftps:write config-ref="FTPS_Basic_Config" fileName="test_read.txt"
	filePath="/files" input-ref="&quot;Test file content&quot;" doc:name="FTPS"/>
    </flow>
</mule>