com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Quick Start Guide

WSO2 Enterprise Integrator 6.6.0 (WSO2 EI) is the latest release of the WSO2 EI 6.x.x family. It is a comprehensive solution that allows you to seamlessly integrate applications, services, data, and business processes to support modern enterprise integration requirements. 

For this quick start guide, let's consider a basic Health Care System where WSO2 EI is used as the integration software. In this guide, an external party (a patient) wants to make a doctor's reservation at a given hospital.

Routing requests based on message content

This is a 5-minute guide to give you a quick overview of how WSO2 EI mediates and routes messages from a front-end service (client) to a back-end service.

Before you begin,

  1. Download the product installer from here, and run the installer.
    Let's call the installation location of your product the <EI_HOME> directory. This is located in a place specific to your OS as shown below:

    OSHome directory
    Mac OS/Library/WSO2/EnterpriseIntegrator/6.6.0
    WindowsC:\Program Files\WSO2\EnterpriseIntegrator\6.6.0\
    Ubuntu/usr/lib/wso2/EnterpriseIntegrator/6.6.0
    CentOS/usr/lib64/EnterpriseIntegrator/6.6.0

  2. Download and start the back-end service that will process appointment requests:
    1. Download the JAR file of the back-end service.
    2. Open a terminal and navigate to the location where your saved the back-end service.

    3. Execute the following command to start the service:

      java -jar Hospital-Service-JDK11-2.0.0.jar
  3. If you are on a Windows OS, install cURL. For more information, see the cURL Releases and Downloads.

Let's get started!

Configuring WSO2 EI

  1. Start the ESB profile:

    WSO2 EI 6.6.0 consists of many profiles. The ESB profile is used for managing short-running and stateless integrations. For more information, see the WSO2 EI Overview.

  2. Open the ESB profile's Management Console using https://localhost:9443/carbon, and log in using admin as the username and password.

    The management console provides a UI to configure the product profile.

  3. Download the SampleServicesCompositeApplication_1.0.0.car file from GitHub.

     Click here to find out what is inside the CAR file

    This file is a Carbon Application Archive (CAR file) containing the integration artifacts you will use in this quick start, including:

    • An API resource, which acts as the endpoint that accepts incoming requests from a client, routes them to the back-end service for processing, receives a response from the service, and sends the response back to the client.
    • A Switch Mediator  to route messages based on the message content to the relevant HTTP endpoint defined in the ESB.
    • A Log Mediator to log the message stating that the switch mediator is routing the message to the correct endpoint.
    • A Send Mediator to send the appointment request to the correct hospital endpoint.

    If you want to try out this same guide by configuring the artifacts, try out the tutorial on Routing Requests Based on Message Content.

  4.  Deploy the SampleServicesCompositeApplication_1.0.0.car as follows:

    1. On the Main tab of the Management Console, go to Manage > Carbon Applications and click Add
    2. Click Choose File, select the SampleServicesCompositeApplication_1.0.0.car file that you downloaded, and click Upload

    3. Refresh the page to see the Carbon application you just added in the Carbon Applications List screen.

Sending requests to WSO2 EI

We are now ready to request a doctor's appointment at Grand Oak Community Hospital.  

  1. Create a JSON file named request.json with the following payload to specify the details the back-end service needs to make the appointment: patient information, doctor name, hospital name, and appointment date. 

    {
      "patient": {
        "name": "John Doe",
        "dob": "1940-03-19",
        "ssn": "234-23-525",
        "address": "California",
        "phone": "8770586755",
        "email": "johndoe@gmail.com"
      },
      "doctor": "thomas collins",
      "hospital": "grand oak community hospital",
      "appointment_date": "2025-04-02"
    }

    If you want to request a different hospital, you can specify one of the following hospital names instead.

    • clemency medical center

    • pine valley community hospital

  2. Open a terminal, navigate to the directory where you have saved the request.json file, and execute the following cURL command.

    curl -v -X POST --data @request.json http://localhost:8280/healthcare/categories/surgery/reserve --header "Content-Type:application/json"

    This command sends the JSON payload you created in the previous step to the API resource (http://localhost:8280/healthcare/categories/surgery/reserve), which was included in the CAR file you uploaded. The API resource contains the logic for routing appointment requests to the back-end service. 

    You get the following response:

    > POST /healthcare/categories/surgery/reserve HTTP/1.1
    
    > Host: localhost:8280
    > User-Agent: curl/7.54.0
    > Accept: */*
    > Content-Type:application/json
    > Content-Length: 285
    > 
    * upload completely sent off: 285 out of 285 bytes
    < HTTP/1.1 200 OK
    < Content-Type: application/json
    < Date: Tue, 21 May 2019 09:14:45 GMT
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host localhost left intact
    
    {"appointmentNumber":1,"doctor":{"name":"thomas collins","hospital":"grand oak community hospital","category":"surgery","availability":"9.00 a.m - 11.00 a.m","fee":7000.0},"patient":{"name":"John Doe","dob":"1940-03-19","ssn":"234-23-525","address":"California","phone":"8770586755","email":"johndoe@gmail.com"},"fee":7000.0,"confirmed":false,"appointmentDate":"2025-04-02"}
  3. Now check the terminal window and you see the following message: 

    INFO - LogMediator message = Routing to grand oak community hospital

Congratulations, you have successfully completed this guide!
In this quick start, you have created a request payload and send it to an endpoint in WSO2 EI, which routes the message to a back-end service, and then sends a response back to the client. 

What's next?
 Additional Capabilities

Exposing a datasource as a service

 Click here to try it out!

Now, let's set up an already configured database that has doctor details and expose this database as a data service using WSO2 EI. We can then check the availability of doctors in the healthcare service without interacting with the database. 

Follow the steps given below.

Set up the back-end database

First, let's set up a back-end database for our healthcare service. Follow the steps below to create the database.

  1. Download the dataServiceSample.zip file from GitHub and extract it to a location on your computer.

    Let's refer to the extracted  dataServiceSample  directory as <QSG_HOME>, which contains the following:

    • A DB script to create the back-end database (DATA_SERV_QSG) that includes channeling information of the healthcare service.
    • A pre-packaged data service (DOCTORS_DataService.dbs file), which can expose the back-end database as a service.
  2. Open a terminal, navigate to the <QSG_HOME> directory, and execute the following command:

    ant -Ddshome=PATH_TO_EI_HOME

The  DATA_SERV_QSG  database is now created in the <EI_HOME>/samples/data-services/database directory with information of all available doctors in the healthcare service.

Expose the database as a data service

Now, let's start the ESB profile and upload the sample data service:

  1. Start the ESB profile:

    If you have started the ESB profile previously, stop the server by pressing  Ctrl+C and restart it using the following commands.

  2. In your Web browser, navigate to the WSO2 EI management console using the following URL: https://localhost:9443/carbon/
  3. Log in to the Management Console using the following credentials:
    • Username: admin
    • Password: admin
  4. Go to the Main tab and click Data Service > Upload
  5. Upload the DOCTORS_DataService.dbs file from the <QSG_HOME> directory.
  6. Refresh the page to see the deployed data service in the Deployed Services screen.

The database of the channeling service is now exposed through the DOCTORS_DataService data service, which we just deployed in WSO2 EI.

Request doctors' information

Assume that you want information on the availability of all surgeons. Open a terminal and execute the command given below. Note that we are specifying 'surgery' as the specialty.

curl -v http://localhost:8280/services/DOCTORS_DataService/getDoctors?SPECIALITY=surgery

The information about the availability of all surgeons will be published on your terminal:

<DOCTORSLIST xmlns="http://ws.wso2.org/dataservice">
<DOCTOR>
    <NAME>thomas collins</NAME>
    <HOSPITAL>grand oak community hospital</HOSPITAL>
    <SPECIALITY>surgery</SPECIALITY>
    <AVAILABILITY>9.00 a.m - 11.00 a.m</AVAILABILITY>
    <CHARGE>7000</CHARGE>
</DOCTOR>
<DOCTOR>
    <NAME>anne clement</NAME>
    <HOSPITAL>clemency medical center</HOSPITAL>
    <SPECIALITY>surgery</SPECIALITY>
    <AVAILABILITY>8.00 a.m - 10.00 a.m</AVAILABILITY>
    <CHARGE>12000</CHARGE>
</DOCTOR>
<DOCTOR>
    <NAME>seth mears</NAME>
    <HOSPITAL>pine valley community hospital</HOSPITAL>
    <SPECIALITY>surgery</SPECIALITY>
    <AVAILABILITY>3.00 p.m - 5.00 p.m</AVAILABILITY>
    <CHARGE>8000</CHARGE>
</DOCTOR>
</DOCTORSLIST>

Congratulations, you have successfully sent a request to the data service!

What's next?

Want to know more and evaluate WSO2 EI further? See the other tutorials under the Additional Capabilities section.

Guaranteeing message delivery

 Click here to try it out!

Now, instead of sending the request directly to the back-end service, let's store the request message in the Message Broker profile of WSO2 EI. We will use a message processor to retrieve the message from the store and then to forward the message to the back-end service. Store and forward messaging is used for serving traffic to back-end services that can accept request messages only at a given rate. This is also used to ensure guaranteed delivery of messages. That is, the messages received are never lost since they are stored in the message store and, thereby, available for future reference. 


Let's get started!

Configuring WSO2 EI

  1. Open the <EI_HOME>/conf/jndi.properties file and add the following line after queue.MyQueue = example.MyQueue:

    queue.PaymentRequestJMSMessageStore=PaymentRequestJMSMessageStore
  2. Start the Message Broker profile:

  3. Download and start the back-end service that will process appointment requests:

    If you have started the back-end service previously, skip this step.

    1. Download the JAR file of the back-end service.
    2. Open a terminal and navigate to the location where your saved the back-end service.

    3. Execute the following command to start the service:

      java -jar Hospital-Service-2.0.0-EI7.jar
  4. Start the ESB profile:

    If you have started the ESB profile previously, restart the server.

  5. Open the ESB profile's management console using https://localhost:9443/carbon, and log in using admin as the username and the password.
  6. Download the SampleServicesCompositeApplication_1.0.0.car file from GitHub.

    This file is a Carbon Application Archive (CAR file) containing the integration artifacts you will use in this quick start, including:

    • An API resource, which acts as the endpoint that accepts incoming requests from a client, routes them to the back-end service for processing, receives a response from the service, and then sends the response back to the client.
    • A Switch Mediator  to route messages based on the message content to the relevant HTTP endpoint defined in the ESB.
    • A Store Mediator to enqueue messages passing through its mediation sequence in a given message store.
  7. Deploy the SampleServicesCompositeApplication_1.0.0.car file as follows:

    If you already deployed the SampleServicesCompositeApplication_1.0.0.car file when following the first part of this QSG, be sure to go to  Manage > Carbon Applications > List and delete it before proceeding with the below steps.

    1. On the Main tab of the management console, go to Manage > Carbon Applications and click Add
    2. Click Choose File, select the SampleServicesCompositeApplication_1.0.0.car file that you downloaded, and click Upload

    3. Refresh the page to see the carbon application you just added in the Carbon Applications List screen.

Sending requests to WSO2 EI

  1. Create a JSON file named request.json with the following payload to specify the details the back-end service needs for making the appointment: patient information, doctor name, hospital name, and appointment date. 

    {
    "name": "John Doe",
    "dob": "1940-03-19",
    "ssn": "234-23-525",
    "address": "California",
    "phone": "8770586755",
    "email": "johndoe@gmail.com",
    "doctor": "thomas collins",
    "hospital": "grand oak community hospital",
    "cardNo": "7844481124110331"
    }
  2. Open a command line terminal and execute the following command from the location where the request.json file you created is saved:

    curl -v -X POST --data @request.json http://localhost:8280/healthcare/categories/surgery/reserve --header "Content-Type:application/json"

    This command sends the JSON payload you created in the previous step to the API resource (http://localhost:8280/healthcare/categories/surgery/reserve), which was included in the CAR file you uploaded. The API resource contains the logic for routing appointment requests to the back-end service you deployed. 

    You will see the response as follows:

    {"message":"Payment request successfully submitted. Payment confirmation will be sent via email."}
  3. Check the terminal and see that the response from the SettlePaymentEP endpoint is logged as follows:

    [2018-06-07 11:46:48,936] [EI-Core]  INFO - LogMediator message = Routing to grand oak community hospital
    
    [2018-06-07 11:46:48,949] [EI-Core]  INFO - TimeoutHandler This engine will expire all callbacks after GLOBAL_TIMEOUT: 120 seconds, irrespective of the timeout action, after the specified or optional timeout
    
    [2018-06-07 11:46:52,003] [EI-Core]  INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:995e37e3-8900-4da8-8eea-67da91de2c12, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><jsonObject><appointmentNo>1</appointmentNo><doctorName>thomas collins</doctorName><patient>John Doe</patient><actualFee>7000.0</actualFee><discount>20</discount><discounted>5600.0</discounted><paymentID>eb83d9cc-0230-4dc8-a613-33b419cebbd7</paymentID><status>Settled</status></jsonObject></soapenv:Body></soapenv:Envelope>

Congratulations, you have successfully sent a message to the WSO2 ESB profile!

What's next?

For more information on the artifacts used in the section, you can try out the tutorial on Storing and Forwarding Messages.

Defining a BPMN process

 Click here to try it out!

In this section, a simple BPMN process prints a 'Hello World!' message when the process instance is initiated.

  1. Download the HelloWorldServiceTask-1.0.0.jar file from GitHub. This includes the defined BPMN process.

  2. Copy the JAR file to the <EI_HOME>/lib directory.

  3. Start the BPS profile:

    The WSO2 EI product has many profiles. Long-running, stateful business processes are run using the Business Process profile. For more information, see the WSO2 EI Overview.

  4. In a new browser window or tab, open the EI-Business Process profile's management console: https://localhost:9445/carbon/
  5. Log in to the management console using  admin  for both the username and password.
  6. Download the HelloWorld.bar file from GitHub.
  7. In the management console, navigate to the Main tab, click BPMN, and upload the HelloWorld.bar file. 
  8. Refresh the page to see the file you just added.
  9. Log in to the BPMN explorer using https://localhost:9445/bpmn-explorer. Use admin for both the username and password.
  10. Go to the PROCESS tab and click Start to start the Hello World Process.
  11. In the terminal, the "Hello World ...!!!" string is printed. 

You have successfully defined a BPMN process and initiated it!

What's next?

Other capabilities

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.