Mule4: Passing Query Parameters to the HTTP URL
This tutorial explains how to pass query parameters to the HTTP URL and fetch within Mule.
Join the DZone community and get the full member experience.Join For Free
This is a simple program where beginners can focus on learning the passing query parameters to the HTTP URL and be able to fetch within the Mule application. As part of the exercise, I am running the application in debug mode so that beginners can start exploring the details of the payload by running different commands in the expression tab. Debug mode is the best practice to learn Mule quickly.
1) Please find the screenshot with the components dragged from the Mule Palette. Also, XML details are given in the next screenshot.
2) Right click on the "Set Payload" component and then click on Toggle breakpoint.
3) After that, you would be able to see the Red colored dot on the left side of the "Set payload" component. With this step, you have set up the breakpoint. When you run the Mule application in debug mode, the application pauses at the breakpoint and we are then able to run the expression to evaluate different equations.
4) After that, you can start the application in debug mode.
5) After that, please click on the postman with the below URL as mentioned on the screen.
6) Once you click on the Send button, it will change to Sending, and the control stops at the breakpoint shown below.
7) Click on the "Mule Debugger", which is next to the "Console", and then click on "Expression tab"(X+Y=?).
8) Now you should able to see the expression button. Over there, you can type "attributes".
9) Please explore by accessing different keys in the attribute section. For example, I have typed the below command as shown in the screen, and you are able to view the query parameters passed in the Postman. Please verify it.
Although the program looks simple, many beginners fail to understand the basic concepts of query parameters. With this example, I am sure all beginners will be able to pick up the query parameters example and also learn how to do the debugging in the Mule application. I wish you luck!
Opinions expressed by DZone contributors are their own.