Upload to FTP after converting JSON to XML icon

Upload to FTP after converting JSON to XML

(0 reviews)

home

Illustrates the concept of DataMapping to convert JSON data to XML. It also shows you how to configure and use the FTP connector to upload a file to a FTP server.

Example

In this example, JSON data is sent to the Mule application through an HTTP end point. This data is then converted to the XML format using the DataMapper transformer after which the message payload is uploaded to the FTP folder.

Set Up and Run the Example

  1. Open the example project in Anypoint Studio from Anypoint Exchange. In the Package Explorer pane in Studio, right-click the project name, then select Run As > Mule Application. Studio runs the application and Mule is up and kicking!

  2. Make a POST request using Postman to http://localhost:8081 with following JSON message body:

     {
     "employees": {
     "employee": [
       {
         "name": "John",
         "lastName": "Doe",
         "addresses": {
           "address": [
             {
               "street": "123 Main Street",
               "zipCode": "111"
             },
             {
               "street": "987 Cypress Avenue",
               "zipCode": "222"
             }
           ]
         }
       },
       {
         "name": "Jane",
         "lastName": "Doe",
         "addresses": {
           "address": [
             {
               "street": "345 Main Street",
               "zipCode": "111"
             },
             {
               "street": "654 Sunset Boulevard",
               "zipCode": "333"
             }
           ]
         }
       }
     ]
     }
     }
  3. Verify if the file was uploaded at http://ftp-server.demo.solarwinds.com/ with the following credentials:

     login: demo
     password: demo
     folder: Upload

    Note: The FTP uploaded file name is set to muleExample.xml, but it can be changed using the outputPattern attribute within the FTP connector operation.

Documentation

Read full documentation in GitHub

Examples to Try Next

If you understood this example
Datamapper with Flow Reference Lookup - Learn how to append data to a message payload and perceptively connect with Salesforce.View
If you struggled with this example
Mule Expression Language Basics - An introduction to most of the basic implementations of Mule Expression Language (MEL).View

Reviews

TypeExample
OrganizationMulesoft Inc.
Published by
MuleSoft Organization
Published onMar 17, 2018
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0