WSO2 Integration Cloud is a runtime that allows you to deploy different types of applications and services, manage their versions, host databases, connect to external Cloud services, and manage other integration requirements of your connected business.
This guide walks you through the basic functionality of WSO2 Integration Cloud using WSO2 ESB Composite Application type as an example.
Introducing the sample
In this guide, we use a sample in a healthcare system in which a user reserves a medical appointment by providing his/her personal details, preferred hospital, doctor's name, credit card information etc. Your application processes the user's request and returns an appointment confirmation or a refusal.
Developing your application
Let's start by downloading WSO2 Integration Studio to develop your WSO2 ESB Composite Application:
Deploying your application
Now that you have developed an ESB composite application, let's deploy it in WSO2 Integration Cloud.
- Sign up to WSO2 Integration Cloud via http://wso2.com/cloud/. The UI will guide you through the registration process.
- Sign in to WSO2 Integration Cloud, go to the Integration Cloud tab, and then click ESB Composite Application.
- On the screen that is displayed, click CREATE APPLICATION.
- Under Integration, click WSO2 ESB Composite Application.
- Specify the following as values:
- Application Name:
SampleProjectCompositeApplication
- Application Version:
1.0.0
- Application Name:
- Upload the CAR file that you created in the previous section. If you did not create the project from scratch, use this file.
- Once the application is created, its homepage opens.
You have now deployed an ESB service in WSO2 Integration Cloud using an archive file. Next, let's invoke this application.
Invoking your application
Let's invoke the application's REST endpoint.
- Click the Swagger URL that is associated with the application to open the Swagger definition in your browser.
Note the Swagger definition of the REST API that opens.
According to the Swagger definition, let's create an appointment request to the REST API.
Create a JSON file named
reserve_appointment.json
with the following request:
{ "reserveRequest": { "patientDetails": { "name": "Mark Smith", "dob": "1990-03-19", "ssn": "ASJK-asnda-AAA", "address": "100 MAIN ST, SEATTLE WA 98104, USA", "phone": "0770596754", "email": "marksm@mymail.com" }, "doctor": "thomas collins", "hospital": "grand oak community hospital", "category": "surgery", "cardNo": "7844481124110331" } }
Install curl in your machine if you have not done so already.
Using the Command-line or Terminal, navigate to the location where you saved the
reserve_appointment.json
file and execute the following curl command. You can get the <REST API URL> from the application's Overview page.curl -v -X POST "<REST API URL>/reserve" --header "Content-Type: application/json" -d @reserve_appointment.json -k -v Here's an example: curl -v -X POST "https://companyn-sampleprojectcompositeapplication.wso2apps.com/hospitalservice/reserve" --header "Content-Type: application/json" -d @reserve_appointment.json -k -v
The configuration inside WSO2 ESB receives and processes the request and give a response similar to the one below:
You have now invoked the REST endpoint of the ESB composite application.
Creating a new version
Let's say you want to make a modification to the current application. You can do this by changing your application via the Tooling interface as you did in a previous section, exporting the modified application as a CAR file, and then uploading the new CAR file as the new version of your current application back in the Integration Cloud.
Assuming that you already have the modified your application and got the CAR file, let's create a new version of the application.
- Open the Integration Cloud and click the application that you want to version. In this example, it is the
SampleProjectFromFileSystem
application.
- The application opens on the console. Click the + icon right next to the versions drop-down to create a new version of the application.
Select the Local File System option and click Continue.
In the form that opens, give the new version (e.g., 2.0.0), upload the new archive file, scroll down, and click Create.
The new application version opens on the console. Note that version 2.0.0 is selected in the drop-down list on the console.
Click the drop-down box and note that both versions are available for the application.
You have now deployed a new version of an existing application using an archive file. You can invoke this version by selecting version 2.0.0 from the drop-down and following the same steps as before.
Updating an existing version
Sometimes, after creating an application, you might want to do modifications to it without creating a new version altogether.
- Open the Integration Cloud and click the application that you want to update (e.g.,
SampleProjectCompositeApplication
).
- The application opens on the console. Click the down-arrow near the version drop-down and select version 2.0.0 of the application. This is the version that we are updating in this example.
- Click Update.
Note that you are given several options to update. Le's use the Update from Local File System option in this guide.
Upload the new sample file with the changes you want to add to the application, provide a reason for the update in the comments section, and click Update.
Note that for version 2.0.0, which you just updated, the button name changes to Update or Rollback.
Click the Update or Rollback button and note that you can revert to any of the previous applications (in this case, there is only one) or you can do further updates to the application. Each update you do is saved in history so that you can revert anytime you like.
You have now updated an existing version of an application using an archive file.
In this guide, you developed a sample ESB composite application, deployed it WSO2 Integration Cloud, invoked, and versioned it.
What's next?
See our Tutorials or Integration Solutions for more advanced business use cases.