Quick Start Guide¶
Welcome to the WSO2 Micro Integrator Quick Start Guide, your step-by-step tutorial for getting started with WSO2 Micro Integrator (MI). WSO2 MI enables you to build, deploy, and manage integration solutions with ease, providing flexibility and scalability to connect applications, services, and systems.
In this guide, you'll learn the basics of setting up and using WSO2 MI to create and deploy a basic integration flow with minimal hassle.
Prerequisites¶
You need Visual Studio Code (VS Code) with the Micro Integrator for VS Code extension installed.
Info
See the Install Micro Integrator for VS Code documentation to learn how to install Micro Integrator for VS Code.
Follow the instructions below to create your first integration solution:
What you'll build¶
Let’s try a simple scenario where the client sends a request to a HelloWorld
API deployed in the WSO2 Micro Integrator and the API calls a backend service and returns its response. The backend service responds a Hello World!!!
message, and the API deployed in the WSO2 Micro Integrator forwards this response to the client.
You can use the following HelloWorld
service as the backend service.
URL |
https://apis.wso2.com/zvdz/mi-qsg/v1.0
|
HTTP Method |
GET
|
Step 1 - Create a new integration project¶
To develop the above scenario, let's get started with creating an integration project in the Micro Integrator extension installed VS Code.
-
Launch VS Code with the Micro Integrator extension installed.
-
Click on the Micro Integrator icon on the Activity Bar of the VS Code editor.
-
Click Create New Project on Micro Integrator Project Explorer. For more options for creating a new integration project, see Create an Integration Project.
-
In the Project Creation Form, enter
HelloWorld
as the Project Name. -
Ensure
4.4.0
is selected as the Micro Integrator runtime version. -
Provide a location for the integration project under Project Directory.
-
Click Create.
Once you click Create, the Add Artifact pane will be opened.
Note
You need the following to work with the MI for VS Code extension.
- Java Development Kit (JDK) version 21
- WSO2 Micro Integrator (MI) 4.4.0 runtime
If you don't have them installed on your local machine, these will be automatically prompted for downloading and configured by the Micro Integrator for VS Code extension during the project creation step:
-
Click Download Java & MI to download and set up Java and MI runtime.
Info
If a different JDK or WSO2 MI version is installed on your local machine, you'll be prompted to download the required versions.
- Click Download to install the required JDK or/and MI version(s).
- Once the download is complete, configure the Java Home or/and MI Home paths by clicking Select Java Home or/and Select MI Path, respectively.
If the required JDK and WSO2 MI versions are already installed, you can directly configure the Java Home and MI Home paths in this step by clicking Select Java Home and Select MI Path, respectively.
Once the process is complete, a window reload will be required, and you will be prompted with the following message:
-
Click Reload Window.
Step 2 - Create an API¶
Now the integration project is ready to add an API. In this scenario, the API calls a backend service and responds to the client. First, let's create an API.
-
In the Add Artifact interface, under Create an Integration, click on API. This opens the API Form.
-
Enter
HelloWorldAPI
as the API Name. The API Context field will be automatically populated with the same value. -
Click Create.
Once you create the API, a default resource will be automatically generated. You can see this default resource listed in the Service Designer under Available resources. You'll use this resource in this tutorial.
Step 3 - Design the integration¶
Now it's time to design your API. This is the underlying logic that's executed behind the scenes when an API request is made. In this scenario first, you need to call the backend service. For that, you have to add an HTTP connection. Follow the below steps to create an HTTPS connection.
-
Open the Resource View of the API resource by clicking the
GET
resource under Available resources on Service Designer. -
Once you open the Resource View, click on the + icon on the canvas to open the palette.
-
Under Mediators > HTTP select the GET operation .
-
In the Add Get pane that appears, click Add new connection.
-
Under Add New Connection, select HTTPS.
-
Specify the following values:
Property Value Connection Name HelloWorldConn
Base URL https://apis.wso2.com
-
Click Add.
You'll be directed to the Add Get pane again.
-
Enter
/zvdz/mi-qsg/v1.0
as the Relative Path. -
Click Submit.
Now let's add a Respond Mediator to respond the message to the client.
-
Click on the + icon placed just after the HTTPS GET operation to open the palette.
-
Select Respond mediator under Mediators.
-
Click Add.
Following is what you'll see in the Source View of the VS Code.
Info
You can view the source view by clicking on the Show Source (</>
) icon located in the top right corner of the VS Code.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/helloworldapi" name="HelloWorldAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/">
<inSequence>
<http.get configKey="HelloWorldConn">
<relativePath>/zvdz/mi-qsg/v1.0</relativePath>
<headers>[]</headers>
<forceScAccepted>false</forceScAccepted>
<disableChunking>false</disableChunking>
<forceHttp10>false</forceHttp10>
<noKeepAlive>false</noKeepAlive>
<responseVariable>http_get_1</responseVariable>
<overwriteBody>true</overwriteBody>
</http.get>
<respond/>
</inSequence>
<faultSequence>
</faultSequence>
</resource>
</api>
Step 4 - Run the integration artifacts¶
Now that you have developed an integration using the Micro Integrator for the Visual Studio Code plugin, it's time to deploy the integration to the Micro Integrator server runtime.
Click the Build and Run icon located in the top right corner of VS Code.
Step 5 - Test the integration service¶
Now, let's test the integration service. For that, you can use the inbuilt try-it functionality in the MI for VS Code extension.
When you run the integration artifact as in Step 4, the Runtime Services interface is opened up. You can see all the available services.
Select HelloWorldAPI
that you have developed and test the resource.
Congratulations! Now, you have created your first integration service.
Additionally, you can use the Integration Control Plane (ICP) to observe details of the deployed artifacts.
What's next?¶
Try more tutorials and examples.