This article is the continued part of the MuleSoft series and the next part of the last posted article. Before jumping into this article, I highly recommended reading these articles for better understanding.
If you would like to understand the basics of MuleSoft, refer to these articles before going next:
Getting Started
- First, open Anypoint Studio and Create a New Mule Project.
- Enter the project name and select runtime and project location and click Finish button.
- Next add a New Mule Configuration file for global settings.
- Give the file name global and click Finish.
- Next go to global.xml file and click on Global Elements tab and click Create button and select HTTP Listener config and click OK.
- Enter the required details like listener name, protocol, host, and port. I am keeping everything as default and click OK.
- Global configuration is done for HTTP listener, let’s work on Message flow. Drag and drop HTTP Listener from HTTP Palette to Message Flow.
- Go to HTTP listener properties and provide listener name, Connector configuration (Which we setup in global.xml file) and Path (Will get call from Postman).
- Drag and drop Set Variable from Core palette.
- Set variable Name and Value.
- Drag and drop Set Payload from Core palette.
- Provide display name Settings value.
- Finally, drag and drop Logger to see the log.
- Set Logger properties.
- That’s it. Now time to deploy the application. Right click on file and click Run As Mule Application.
- Once you see the message Deployed, that means everything is good and application is deployed.
- Open Postman to see the result.
Everything is looking good.
Conclusion
In this article, we learned how to set variable and set payload in MuleSoft and how to see the variable result in Postman.