Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial demonstrates how to integrate an external WSO2 API Manager (APIM) with WSO2 G-Reg. 

Table of Contents
maxLevel3

Introduction

WSO2 Governance Registry is a registry-repository for storing and managing metadata related to services and other artifacts. Services  G-Reg implements Services (SOAP or REST)  in WSO2 G-Reg are implemented as configurable governance artifacts (RXT files)which you create using the G-Reg Publisher or its Management Console. Usually, you publish a service in WSO2 APIM service publication is done using the APIM Publisher Web web interface. Instead, you can integrate WSO2 APIM with WSO2 G-Reg, to directly publish APIs to APIM Publisher using the services deployed in the WSO2 Governance Registry.This G-Reg. This guide explains how to configure the two products to expose services in the G-Reg as APIs in the WSO2 APIM.

Prerequisites

Follow the steps below to set up the required prerequisites before starting the integration.

  1. Download WSO2 API Manager (version 1.9.x

    Download WSO2 Governance Registry (version 5.0.0 and above), and start the server.

    For

     For instructions on running WSO2

    APIM

    G-Reg, see Running the Product.

    Download WSO2 Governance Registry (version 5.0.0 and above).

     

    Tip

    Change the default port of WSO2 G-Reg (e.g. set a port offset of 1),

     to

     to avoid port conflicts that may arise

    when

    when running more than one WSO2 products on the same server. For instructions, see Changing the Default Ports with Offset.

  2. Start the WSO2 G-Reg server.  For Download WSO2 API Manager (version 1.9.x and above), and start the server.  For instructions on running WSO2 G-RegAPIM, see Running the Product. 

Anchor
Configuring WSO2 G-Reg
Configuring WSO2 G-Reg
Configuring WSO2 G-Reg to publish services

...

  1.  Log in to the G-Reg Management Console using the following URL and admin/admin credentials:  https://10.100.5.72:9444/carbon

  2. Click Extensions, and then click Lifecycles.
  3. Click the corresponding View/Edit Link of the ServiceLifeCycle as shown below.
    edit the ServiceLifeCycle configuration
  4. Anchor
    executor
    executor
    Replace the  <execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ApiStoreExecutor"> element in the configuration with a code block which defines an execution element in production state as shown in the example below. Add the API Manager credentials in it, so that it provides the API Manager's endpoint, username and password as executor parameters.

    Tip

    Alternatively, you can do this change in the <GREG_HOME>/repository/resources/lifecycles/ServiceLifeCycle.xml file and then restart the G-Reg server.

    Code Block
    languagehtml/xml
    <execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ServiceToAPIExecutor">
       <parameter name="apim.endpoint" value="http://localhost:9763/"/>
       <parameter name="apim.username" value="admin"/>
       <parameter name="apim.password" value="admin"/>
       <parameter name="apim.env" value="dev"/>
       <parameter name="default.tier" value="Unlimited"/>
       <parameter name="throttlingTier" value="Unlimited,Unlimited,Unlimited,Unlimited,Unlimited"/>
    </execution>
    Info

    If you need to publish a REST service to WSO2 API Manager, replace the  <execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ApiStoreExecutor">  element in the  <GREG_HOME>/repository/resources/lifecycles/ServiceLifeCycle.xml  file with a code block which defines an  execution  element in  production  state as shown in the example below. Add the API Manager credentials in it, so that it provides the API Manager's endpoint, username and password as executor parameters.

    Code Block
    languagexml
    <execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.RestServiceToAPIExecutor">
       <parameter name="apim.endpoint" value="http://localhost:9763/"/>
       <parameter name="apim.username" value="admin"/>
       <parameter name="apim.password" value="admin"/>
       <parameter name="apim.env" value="dev"/>
       <parameter name="default.tier" value="Unlimited"/>
       <parameter name="throttlingTier" value="Unlimited,Unlimited,Unlimited,Unlimited,Unlimited"/>
    </execution>
  5. Click Save.

  6. Click Yes in the message which pops up.

Expand
titleConfiguring to publish multiple (SOAP and REST) service types

...

 If you have already published a SOAP service and if you want to publish a REST service (or vice versa) in the same G-Reg server, you need to create a new lifecycle and assign the corresponding executor to the artifact type. Follow the steps below to do this.

  1. Log in to the G-Reg Management Console using the following URL and admin/admin credentials:  https://10.100.5.72:9444/carbon
  2. Click Extensions, and then click Lifecycles.
  3. Click the corresponding View/Edit Link of the ServiceLifeCycle.
  4. Copy the configuration in the editor, and

...

  1. click Cancel.

...

  1. Click Add New Lifecycle.
  2. Paste the configuration

...

  1. you copied in the editor.
  2. Replace the configuration of the executor accordingly as

...

  1. per step 4 in

...

  1. the Configuring WSO2 G-Reg

...

  1.  section above.
  2. Change the name of the lifecycle as shown in the example below.
    <aspect name="NewServiceLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">

...

  1. Click Save, and then

...

  1. click Artifact

...

  1. Types in the left navigation menu.
  2. Click

...

  1. the View/Edit

...

  1.  link of

...

  1. the Artifact Type

...

  1.  to which you need to assign the new lifecycle with the corresponding executor (i.e. soapservice

...

  1.  or restservice)
  2. Enter the name of the new lifecycle in the configuration as shown in the example below.
    <lifecycle>NewServiceLifeCycle</lifecycle>

...

  1. Click Save.

Creating/editing the

...

service in WSO2 G-Reg

Follow the steps below to create Create the service in WSO2 G-Reg, which you need to publish to WSO2 APIM.

...

For instructions,

...

see Adding and Deleting Assets. (You can also edit an existing service to publish it to WSO2

...

Click Main, and then click SOAP Services in the List menu.

You view the created SOAP service. 

...

Click on the corresponding Service Version link of the service as shown below.
click Service Version of the new serviceImage Removed

...

APIM.)

Tip

When creating the service or editing an exisiting service, add the same values that you provided for the apim.endpoint parameter (e.g. http://localhost:9763/), and apim.env parameter (e.g. "dev") in the lifecycle

...

executor in Integrating with an External WSO2 API Manager

...

,

...

for Environments and URL

...

 in the Endpoints tab as shown in the example below.  

...

define the endpointImage Added

Publishing the Service in WSO2 G-Reg

...