Before You Begin
This OBE shows you how to create an orchestration that uses SSH
file transfer protocol (SFTP) to retrieve and send a file, in
this example a JSON text file, to an FTP server. It also shows
you how to create a custom request that includes a script to
update the retrieved file before returning it to the FTP server.
Duration: 40 minutes
Background
In the JD Edwards EnterpriseOne Orchestrator Studio, you can
configure an orchestration with a connector to enable the
transfer of files to and from external systems. Connectors use
an FTP connection to transfer files. You can also create a
connector that uses a REST connection to send a file to an
external system.
Connections, which you can also create in the Orchestrator
Studio, are soft coding records that provide the connector with
secure access to the external resource.
You can create a custom step that uses scripting to run a custom process or to route data into another database. The Orchestrator Studio provides an edit area that contains a sample script with some instructions on how to modify the script.
What Do You Need
- A JD Edwards EnterpriseOne test environment with a minimum of EnterpriseOne Tools 9.2.6.0.
- Access to an FTP-enabled server with permissions to create a directory and create and view files.
- An FTP client such as WinSCP that you can use to place a file in the directory on the FTP server, as described in the first task in this OBE. This is the file that you will retrieve, update, and send back to the FTP server with an orchestration.
Creating
and Uploading a File to the FTP Server
Create and upload a file to the FTP server. This is the file that you will configure an orchestration to retrieve, update, and send back to the FTP server.
You must have permissions to create and view files in the FTP server directory to perform this task.
- Using a text editor, create a text file called test.json and
paste the following JSON into it:
{
"AB Input": "1234",
"Another Input": "ABCD",
"Status Input": "EXCELLENT"
}
- Save and close the test.json file.
- With an FTP client, such as WinSCP, upload the test.json file to the default location and subdirectory named FTP_PUBLIC.
You will need to create this subdirectory if it does not exist.
Creating
a Connection to the FTP Server
Use the Orchestration Studio to create and configure a connection to your FTP server. The connectors that you will create later in this OBE rely on this connection to transfer files to and from an FTP server.
- Access the Orchestrator Studio.
- Click the Tools link in the top right corner, click Connections.
- In the Connections page, click the New button and select FTP.
- On the Connection Information form, complete these fields:
- Name =
FTP_PUBLIC - Description =
FTP_PUBLIC - User/Role = Enter the user authorized to run the originating orchestration—the orchestration on the local system that will transfer the file to and from the FTP server. The user can be an EnterpriseOne user, role, or *PUBLIC.
- Environment = Enter the EnterpriseOne environment where the local orchestrations reside, for example JDV920.
- In the FTP Connection Details section, complete these fields:
- FTP HOST = yourftpserver.company.com
- FTP Port =
22 - User = Enter an FTP server user name.
- Password = Enter the password for the
FTP server user.
The user name and password that you enter must have access to the FTP server directory or subfolder that was set up in the previous task. - User Secure FTP (SFTP) = Enable SFTP.
- FTP File Path =
/FTP_PUBLIC
This is the path to FTP server subdirectory where you placed the test.json file in the previous task. - Click Save.
The connection should look like this when complete:
Creating
a Connector to Retrieve a File from an FTP Server
In this task, you will use the Orchestration Studio to create a connector for retrieving a file from an FTP server.
- On the Orchestrator Studio home page, click the Connectors icon.
- On the Connectors page, click New and select FTP.
- On the Connector design page, complete these fields:
- Name =
FTP_GetFile - Enter Short Description =
Retrieve file from FTP server. - Click the Product Code drop-down list and select a customer product code, 55 – 59.
- Click the Connection drop-down list and select the FTP_PUBLIC connection.
- Select the File option.
- Click the Type drop-down list and select Receive.
- Complete the following fields:
- Source File Name =
${SourceFileName} - Target File Name =
${SourceFileName} - Select the Use Temporary File Location option.
This will download test.json and save it to the AIS temporary directory.
- Click Save.
Your FTP_GetFile connector should look like this when complete:
Creating
a Connector to Send a File to an FTP Server
In this task, you will use the Orchestration Studio to create a connector for sending a file to an FTP server.
- On the Connectors page, click New and select FTP.
- On the Connector design page, complete these fields:
- Name = FTP_SendFile
- Enter Short Description =Send file to FTP server.
- Click the Product Code drop-down list and select a customer product code, 55 – 59.
- Click the Connection drop-down list and select the FTP_PUBLIC connection.
- Select the File option.
- Click the Type drop-down list and select Send.
- Complete the following fields:
- Source File Name =
${SourceFileName} - Target File Name =
modified.json
The modified test.json file will be saved on the FTP server as modified.json. - Make sure the Use Temporary File Location option is selected.
- Enable Remove File.
The test.json file will be removed from the AIS temporary folder. - Click Save.
Your FTP_SendFile connector should look like this when complete:
Creating
a Custom Request that Uses a Script to Modify the JSON in the
Retrieved File
In this task, you will use the Orchestration Studio to create a custom request that uses JRuby to manipulate the JSON in the test.json file retrieved from the FTP server.
- On the Orchestrator Studio Home page, click the Custom Requests icon.
- On the Custom Requests page, click the New button and select Script from the drop-down list.
- On the Custom design page, complete the following fields:
- Name =
UpdateJSONUsingJRuby - Enter Short Description
=
Use JRuby to modify JSON.
- Name =
- Click the Product Code drop-down list and select a customer product code, 55 – 59.
- In the first row in the Input grid, enter
SourceFileNamein the Input column. - In the first row in the Output grid, enter
outputObjectin both the Output and Variable Name columns. - From the drop-down list above the script entry area select JRuby (if not already selected).
- In the script editing area, replace the JRuby template with this JRuby script (click here). This script will read the file in the AIS temp director (after receiving it from the FTP server), parse the JSON text and update it with changed and new values, and then overwrite the downloaded test.json file in the AIS temp directory. See the comments within the script for more details about the process.
The custom request should look like this when complete:
Creating
an Orchestration for Retrieving, Updating, and Sending the
test.json File
In this task, you will create an orchestration based on the connector and then continue adding the rest of the steps that you created in the previous tasks.
- On the Orchestrator Studio Home page, click the Connectors icon.
- Find the FTP_GetFile connector you just created and select it.
- From the Manage menu select Create Orchestration.
- On the Orchestration design page, complete these fields:
- Name =
FTPReceiveSend_UpdateJSON - Enter Short Description =
Receive a JSON file from an FTP server. Modify it with a script and then send it back to the FTP server. - Click the Product Code drop-down list and select a customer product code, 55 – 59.
- Click Save.
- Click the Start node and select Inputs
and Values.
Notice the Source File Name input is already created for you (based on the connector). Entertest.jsonin the Default Value column. - Select the FTP_GetFile step and select Transformations.
Notice that the Source File Name input is already mapped for you. - Click the End node and select Outputs and
Assertions.
Notice that the FTP_GetFile output is already included for you. - Double-click on the line in the diagram after the
FTP_GetFile step, and select Custom.
Alternatively, you can click Design Mode and click the plus icon (+) to add the step. - Find and select UpdateJSONUsingJRuby. The system adds the new UpdateJSONUsingJRuby step to the orchestration.
- Click the new step and select Transformations.
- Click Auto Map. This will map the matching named input of the orchestration to the step.
- Click Save to save the orchestration.
- Double-click on the line in the diagram after the UpdateJSONUsingJRuby step, and select Connector.
- Find and select the FTP_SendFile connector. The system adds the new FTP_SendFile step to the orchestration.
- Click the new step and select Transformations.
- Click Auto Map.
- Click Save to save the orchestration.
- Click the End node and select Outputs and Assertions.
- Enable the Select option for the two new
steps you just added.
The output should look like this when complete: - Save the orchestration.
The orchestration should look like this when complete:
Testing
the Orchestration
Use the Run Orchestrations page to test the orchestration. And then use an FTP client to verify that the modified.json file returned to the FTP server was changed from the original test.json file.
- Double-click the Start node of the
orchestration to launch the Run Orchestration page.
Notice thattest.jsonis already populated the Source File Name input field from the default value. - Click Run and verify the following
details:
- The output for
FTP_GetFilefile shows that the test.json file was saved to the AIS temp directory.
- The output
outputObjectfield shows that the new JSON that will be written to the modified.json file.
- The output for the
FTP_SendFile shows that the modified test.json was sent from the AIS temp folder and saved as modified.json on the FTP server.
Orchestration Test Output - The output for
- Use your FTP client to view the files on the FTP server.
The test.json file should be unchanged:
{The modified.json file should have the new JSON values from the script:
"AB Input": "1234",
"Another Input": "ABCD",
"Status Input": "EXCELLENT"
}
{
"AB Input": "1234",
"Another Input": "ABCD",
"Status Input": "POOR"
"NewOutput": "MyNewValue"
}
Creating
an Orchestration to Retrieve, Update, and Send a File to an FTP Server