Working with the Microgateway in a Windows Environment

This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with the Microgateway in a Windows Environment

Loading

You can work with the WSO2 API Manager Microgateway in a Microsoft Windows environment as follows:

Before you begin

Make sure to have the following prerequisites in place to initialize a Microgateway instance,

  • Oracle Java 1.8
  • WSO2 API Manager (WSO2 API-M) 2.5.0 or later.
    This is required to bootstrap the Microgateway.
  • WSO2 Microgateway CLI tool
  • NSSM (the Non-Sucking Service Manager)
    This is required if you need to run the Microgateway as a Windows service.

Running the Microgateway on a Windows operation system

Follow the steps below run a WSO2 API Manager Microgateway instance in a Windows environment.

Step 1 - Set up JAVA_HOME

You need to set up JAVA_HOME in order to run the Microgateway CLI tool.

  1. Install the Oracle Java 1.8 or higher version.
  2. Set the JAVA_HOME environment variable as a user variable via the edit system properties UI.

Loading

Step 4 - Run the Microgateway

  1. Copy the <micro-gw-project-name>.zip file from the <project-name>\target directory and extract the files to where you want to run the Microgateway. 
  2. Navigate to the <micro-gw-project-name>/bin directory.

    cd <micro-gw-project-name>/bin
  3. Run the Microgateway.
    This runs the Microgateway instance in the foreground.

    .\gateway.bat

Run the Microgateway as a Windows service

Step 1 - Set up JAVA_HOME

You need to set up Java in order to run the Microgateway CLI tool.

  1. Install Oracle Java 1.8 or later.
  2. Set the JAVA_HOME environment variable as a server variable via the edit system properties UI.

Loading

Step 4 - Install the Gateway script as a Windows service

  1. Download the NSSM (Non-Sucking Service Manager) tool and extract the ZIP file.
  2. Copy the extracted ZIP file to the location where you want to run the Microgateway.
  3. Install the gateway.bat script as a Windows service.
    1. Navigate to the win64 folder, which is inside the new location of the extracted NSSM tool.

      cd apim_2_5_microgateway_bat\nssm-2.24\win64
    2. Run the following command to install the gateway.bat script as a Windows service.

      nssm.exe install microgw
    3. Click Yes when the following User Account Control message appears.
      You need to do this in order to allow the NSSM tool to make changes to your Microgateway distribution.
    4. Click [...] and select the location of the gateway.bat file, which is in the \bin folder of your unzipped Microgateway distribution.
    5. Click Details, and enter the details of the Microgateway service.
    6. Click Install service.
      A confirmation message appears.

Testing the Microgateway

You can invoke the API through the Microgateway using the following cURL command in order to test the Microgateway. By default, the Microgateway serves the HTTPS/WSS request via the 9095 port.

Resetting the Microgateway CLI tool

When you run the Microgateway CLI tool for the first time, it preserves all the information (i.e., your username, APIM base URL, TrustStore location and the TrustStore password) with the exception of your password, for later use. If you want to reset the Microgateway CLI tool in order to clear all the data that has been preserved by the Microgateway CLI tool, you can use the –reset argument as follows. Note that you can invoke the Microgateway CLI tool reset command from any directory in the system.

micro-gw reset