Anypoint Exchange

Home to the complete listing of connectors, templates, examples and APIs.
Discover and use proven assets built by the MuleSoft ecosystem, or add assets to a private
tenant of Anypoint Exchange for collaboration and sharing of internal best practices.

Learn more
Sign up
Upload to FTP after converting JSON to XML

Upload to FTP after converting JSON to XML

(0 reviews)

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

Download
Log into Anypoint Platform to download this asset

Overview

Type
Example
Created by
MO
MuleSoft Organization
Published onJun 22, 2017

Versions

VersionRuntime version
1.4.03.x
1.3.33.7
1.2.23.6