2. Open Anypoint Studio
Create a File New Mule Project
Click «Finish»
3. • Expand the «myfirstproject» on package explorer
Double click on myfirstproject.xml
Once file is open, show Message Flow
From Mule Palette view, search for ‘HTTP’ and ‘Java’ and select the first one.
Drag and Drop HTTP then Java component into Message Flow view.
4. Now we have to configure listener for our HTTP flow.
Double click on HTTP blue element.
Below it will appear HTTP view.
On the General Setting let’s create and choose an HTTP Listener.
Click on Add(+) and configure:
Host: default (localhost)
Port: 8081
On Basic Settings define web service:
Path: /filetransfer
Allow.Methods: GET
Click OK and SAVE
5. Now we have to configure the Java logic component.
Create a package and a Java
class under src/main/java folder.
Create a local folder to save the file.
The class will create a simple text file and write
two lines.
Libraries I used:
java.io.File;
java.io.FileWriter;
Click on SAVE at top-left of screen
7. Now we can start our Mule server
Right Click on project Run As
Mule Application
On the Console view below server
is going to start.
At the end you will see the status
DEPLOYED.
This means that server is up and
running
Open your browser and join the
HTTP path:
http://localhost:8081/filetransfer
Now we can see the result: open
the folder we created and look at
the txt file generated.
Go Mule, go!