Book Image

WSO2 Developer's Guide

By : Ramón Garrido, Fidel Prieto Estrada
Book Image

WSO2 Developer's Guide

By: Ramón Garrido, Fidel Prieto Estrada

Overview of this book

WSO2 Enterprise Integrator brings together the most powerful servers provided by the WSO2 company for your SOA infrastructure. As an Enterprise Service Bus (ESB), WSO2 Enterprise Integrator provides greater flexibility and agility to meet growing enterprise demands, whereas, as a Data Services Server (DSS), it provides an easy-to-use platform for integrating data stores, creating composite views across different data sources, and hosting data services. Using real-world scenarios, this book helps you build a solid foundation in developing enterprise applications with powerful data integration capabilities using the WSO2 servers. The book gets you started by brushing up your knowledge about SOA architecture and how it can be implemented through WSO2. It will help build your expertise with the core concepts of ESB such as building proxies, sequences, endpoints, and how to work with these in WSO2. Going further, you will also get well-acquainted with DSS data service concepts such as configuring data services, tasks, events, testing, and much more. The book will also cover API management techniques. Along with ESB and DSS, you will also learn about business process servers, the rules server and other components that together provide the control and robustness your enterprise applications will need. With practical use cases, the book covers typical daily scenarios you will come across while using these servers to give you hands-on experience.
Table of Contents (14 chapters)

Installing WSO2 Enterprise Integrator

Once we have obtained the up-to-date product ZIP, we are ready to install it. According to the level of the book, we will assume a target reader who will use WSO2 EI for development or testing purposes. We will also assume that the reader has a basic knowledge of WSO2 EI or this is their first contact with WSO2 EI. Advanced users may need to refer to the official product documentation at https://docs.wso2.com/display/EI600/WSO2+Enterprise+Integrator+Documentation.

We will describe the installation under the following assumptions that are not recommended for a production environment:

  • WSO2 EI runs using the default H2 embedded database
  • WSO2 EI H2 embedded registry
  • Standalone configuration

The prerequisites are quite simple, and for most cases, for a development or testing environment, these are enough:

  • Memory of 2 GB minimum and 1 GB heap size.
  • Space disk of 1 GB for installation. This is space just for the component; additional space is needed for logs and databases.
  • JDK 1.8.
  • JavaScript enabled browser.

If we meet these requirements, we will be able to run WSO2 EI. The installation for both the Linux and Windows operating systems are quite simple as well; we just need the JAVA_HOME environment variable properly configured, pointing to the JDK installation. Of course, there are several ways to create environment variables, but we will focus on a standard one, that is valid for most scenarios:

  • Linux:
    1. Edit the BASHRC file in your home directory to add the JAVA_HOME variable definition at the top. The JAVA_HOME variable must point to the JDK installation folder. In this example, we are supposing that it is installed in the following:
/usr/java/jdk1.8.0_121: 
export JAVA_HOME=/usr/java/jdk1.8.0_121 
export PATH=${JAVA_HOME}/bin:${PATH}

2. Verify that the JAVA_HOME variable is properly set in the console using the echo $JAVA_HOME command. The result must be the JDK installation path we set earlier.

  • Windows:

1. Go to System properties | Advanced | Environmental variables.

2. In the System Variable section, add new.

3. Set the name as JAVA_HOME

4. Set the value as the JDK installation path, for example, C:\Program Files\Java\jdk1.8.0_121.

5. Verify that JAVA_HOME is properly set, executing the set JAVA_HOME command in the console. The result must be the JDK installation path.

Now we are ready to launch WOS2 EI. As we discussed in the previous sections, WSO2 EI encapsulates six products that were previously independent of the following:

  • WSO2 ESB.
  • WSO2 Data Services Server (WSO2 DSS).
  • WSO2 Application Server (WSO2 AS). In EI 6.1.1 and so on, it is not a feature anymore.
  • WSO2 Analytics.
  • WSO2 Business Process.
  • WSO2 Message Broker.

The first three products have been merged into just one component called WSO2 EI, so WSO2 EI is made up of the following:

  • WSO2 EI
  • WSO2 EI Analytics
  • WSO2 EI Business Process
  • WSO2 EI Broker

So, when we talk about starting the WSO2 EI, we have several options:

  • Start the four components manually in a specific order
  • Start the four components automatically using the script provided
  • Start the component on demand. According to the level of the book, WSO2 EI Business Process and WSO2 EI Broker require a deeper knowledge of WSO2, so we miss them in this book

Starting components manually

We can start the component one by one on demand. For example, we cannot create business processes in this book, so we do not need to start WSO2 Business Process. In such cases where we do not need a message queue, we do not need to start the WSO2 EI Broker. WSO2 EI Analytics will be useful to check message traces when invoking a service and to get the services statistics, so we will use this component.

We need to start the components in a specific order, as follows:

  1. WSO2 EI.
  2. WSO2 EI Analytics.
  3. WSO2 EI Business Process.
  4. WSO2 EI Broker.

In the following sections, we will see that all of them start and stop the same way.

Starting/stopping WSO2 Enterprise Integrator

To start WSO2 EI, we have to follow these steps:

  1. Open a console and go to the <WSO2EI_HOME>\bin directory.
  2. Type the following command:
    • On Linux or macOS: sh integrator.sh
    • On Windows: integrator.bat --run
  1. You will see a log that the boot up is generating. The server will start up when you see a message log as shown:
      WSO2 Carbon started in X sec
  1. We will also see the URL to access the WSO2 EI console in a message as follows:
      Mgt Console URL  : https://<EI HOST>:<PORT>/carbon/ 
      Where <PORT> is: 
               8243 for WSO2 EI version 6.0.0 
               9443 for WSO2 EI version 6.1.0 o higher 

This port number will not change depending on the version for the rest of the components provided with WSO2 EI.

We will see, similar to the following screenshot, that the server is up:

WSO2 EI boot up finished

In this screenshot, we can see the Management Console URL. We can see that the URL is shown using the host IP. When we access the console from the host that WOS2 EI is running on, we use localhost instead of the host IP. We will use the host IP to access the console from other hosts in the LAN or from internet:

  • WSO2 EI 6.0.0:
    • https://[your_IP]:8243/carbon/
    • https://localhost:8243/carbon/
  • WSO2 EI 6.1.0 or greater:
    • https://[your_IP]:9443/carbon/
    • https://localhost:9443/carbon/

You may have noted that the Management Console uses the HTTPS protocol. This is a secure protocol that encrypts the traffic between the browser and the server for security reasons; to do this, a certification is needed. All WSO2 products are provided with a default certificate that is not signed by a well-known certification authority but is okay for testing purposes. For this reason, when we access the Management Console, the browser will show an untrusted connection warning. We have to accept that certificate to access the Management Console. For a production environment, we will need a certificate generated by a well-known certification authority and then, there will not be any warning when accessing the Management Console.

All these considerations are valid for all the components, so we have to proceed in the same way when starting the other components.

Now we are able to browse to the Management Console:

WSO2 EI Management Console

Now we just have to type the default username and password to sign in:

  • Username: admin
  • Password: admin

Then, the browser will show the WSO2 EI home page:

WSO2 EI home page

WSO2 EI can be shut down/restarted using the console. We can find this option in the Main tab by clicking on the Shutdown/Restart option:

Shutdown and restart from Management Console

We also can shut down the product this way:

  • On Windows: Using Ctrl+C in the command window
  • On Linux/macOS: Using sh integrator.sh stop from the <EI_HOME>/bin/ directory

Starting/stopping WSO2 EI Analytics

The procedure to start this component is quite similar to the WSO2 IE one; we just need to follow these steps:

  1. From Command Prompt (Windows) or shell (Linux), go to the <EI_HOME>/wso2/analytics/bin directory.
  2. Type the following command:
    • On Linux or macOS: sh integrator.sh
    • On Windows: integrator.bat --run
  1. You will see a log that the boot up is generating. The server will start up when you see a message log as illustrated:
      WSO2 Carbon started in X sec 
  1. We will also see a URL to access the WSO2 EI console in a message, as follows:
      Mgt Console URL  : https://<EI HOST>:port/carbon/

The same considerations for accessing WOS2 EI Management Console are valid here. The port, in this case, is offset by 1, so we will browse to https://localhost:9444/carbon. Take a look at the following screenshot:

WSO2 EI Analytics Management Console

We sign in with the Username as admin and Password as admin to get the WSO2 EI Analytics Home:

WSO2 EI Analytics Home

WSO2 EI Analytics can be shut down/restarted using the console. We find these options in the Main tab by clicking on the Shutdown/Restart option. We also can shut down the product this way:

  • On Windows: Using CTRL+C in the command window
  • On Linux/macOS: Using shwso2server.sh stop from the <EI_HOME>/wso2/analytics/bin directory

Starting/stopping WSO2 EI Business Process

The procedure to start this component is quite similar to the WSO2 IE one; we just need to follow these steps:

  1. From Command Prompt (Windows) or shell (Linux), go to the <EI_HOME>/wso2/ business-process/bin directory.
  2. Type the following command:
    • On Linux or macOS: sh.ws02server.sh
    • On Windows: ws02server.bat
  3. You will see a log that the boot up is generating. The server will be started when you see a message log as follows:
      WSO2 Carbon started in X sec 
  1. We will also see a URL to access the WSO2 EI console in a message, as illustrated:
      Mgt Console URL  : https://<EI HOST>:9445/carbon/

The same considerations as for accessing WOS2 EI Management Console are valid here, so we will browse to https://localhost:9445/carbon. Take a look at the following screenshot:

WSO2 EI Business Process Management Console

We sign in with the Username as admin and Password as admin to get the WSO2 EI Business Process Home:

WSO2 EI Business Process Home

WSO2 EI Business Process can be shut down/restarted using the console. We can find this option in the Main tab by clicking on the Shutdown/Restart option. We can also shut down the product this way:

  • On Windows: Using CTRL+C in the command window
  • On Linux/macOS: Using sh wso2server.sh stop from the <EI_HOME>/wso2/ business-process/bin directory

Starting/stopping WSO2 EI Broker

The procedure to start this component is quite similar to the WSO2 IE one; we just need to follow these steps:

  1. From Command Prompt (Windows) or shell (Linux), go to the <EI_HOME>/wso2/ broker/bin directory.
  2. Type the following command:
    • On Linux or macOS: sh.wso2server.sh
    • On Windows: wso2server.bat
  1. You will see a log that the boot up is generating. The server will start up when you see a message log as shown:
      WSO2 Carbon started in X sec   
  1. We will also see a URL to access the WSO2 EI console in a message, as illustrated:
      Mgt Console URL  : https://<EI HOST>:9446/carbon/    

The same considerations for accessing WOS2 EI Management Console are valid here, so we will browse to https://localhost:9446/carbon. Take a look at the following screenshot:

WSO2 EI Broker Management Console

We sign in with the Username as admin and Password as admin to get the WSO2 EI Broker Home:

WSO2 EI Broker Home

WSO2 EI Broker can be shut down/restarted using the console. We can find this option in the Main tab by clicking on the Shutdown/Restart option. We also can shut down the product this way:

  • On Windows: Using CTRL+C in the command window
  • On Linux/macOS: Using sh wso2server.sh stop from the <EI_HOME>/wso2/ broker/bin directory

Starting all the products

In cases where we need to start all the components, we can do it using just one command; we just need to follow these steps:

  1. From Command Prompt (Windows) or shell (Linux), go to the <EI_HOME>/bin directory.
  2. Type the following command:
    • On Linux or macOS: shstart-all.sh
    • On Windows: start-all.bat
  1. The four components will start using a 10-second gap between each launch. After a few seconds, all the components will be up and each Management Console will be available.

To stop the components, we have to stop each of them manually, using each Management Console or using the console instructions.