Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 1

WSO2 products are managed internally using SOAP Web services known as admin services. WSO2 products come with a management console UI, which communicates with these admin services to facilitate administration capabilities through the UI.

Excerpt
hiddentrue

A service in WSO2 products is defined by the following components:

  • Service component: Provides the actual service.
  • UI component: Provides the Web user interface to the service.
  • Service stub: Provides the interface to invoke the service generated from the service WSDL.

...

Table of Contents

Discovering the admin services

By default, the WSDLs of admin services are hidden from consumers. Follow the steps given below to discover them using the OSGi console.

...

Open the carbon.xml file (from the /conf directory of the respective profile), and set the <HideAdminServiceWSDLs> element to false.

Info

The location of the /conf directory (for each of the product profiles in WSO2 EI) is as shown below:

  • For the ESB profile: <EI_HOME>/conf/ directory.
  • For the BPS/MB/Analytics profiles: <EI_HOME>/wso2/<profile_name>/conf/ directory.

Start the relevant product profile:

...

Open a terminal and navigate to the /bin directory.

Info

The location of the /bin directory (for each of the product profiles in WSO2 EI) is as shown below:

  • For the ESB profile: <EI_HOME>/bin/ directory.
  • For the BPS/MB/Analytics profiles: <EI_HOME>/wso2/<profile_name>/bin/ directory.

Execute the product profile's startup script as explained below.

In Linux environments

  • For the ESB profile: sh integrator.sh -DosgiConsole

  • For the BPS/MB/Analytics profiles: sh wso2server.sh -DosgiConsole

In Windows environments

...

For the ESB profile: integrator.bat -DosgiConsole

...

The admin services for your product profile will be listed on your console. For example, shown below is the list of admin services in the ESB profile of WSO2 EI.

...

titleESB admin services

...

Check the list of admin services shown above, and note that the URL of each admin service appears after the admin service's name. See the following example:

...

To see the service contract of an admin service, select the admin service's URL and then paste it into your browser with ?wsdl at the end. For example, if you want to access the ModuleAdminService of the ESB profile, use the following URL: 

https://localhost:8243/services/ModuleAdminService?wsdl

Tip

When you are accessing an admin service in the ESB, note that you are using the 8243 port (assuming 0 port offset). However, you should be accessing the admin services via the management console port. The default management console port for each of the profiles in WSO2 EI are as follows:

  • The ESB profile: 9443

  • The BPS profile: 9445

  • The MB profile: 9446
  • The Analytics profile: 9444
Note

After discovering admin service, you can restart the server without -DosgiConsole.

Invoking an admin service

Admin services are secured using common types of security protocols such as HTTP basic authentication, WS-Security username token, and session-based authentication, to prevent anonymous invocations. For example, the UserAdmin Web service is secured with HTTP basic authentication. To invoke an admin service, you can write your own client program using the Axis2 client API, or you can use an existing tool like SoapUI (4.5.1 or later), or wsdl2java.

Invoking an admin service involves the following steps:

  1. Authenticate yourself and get the session cookie.
  2. Access the back-end service.

Generating a client program to access admin services

Note
iconfalse

The following contents are currently under review!

Tip

To generate the stubs, you can write your own client program using the Axis2 client API, or use an existing tool like SoapUI (4.5.1 or later), or wsdl2java.

The wsdl2java tool, which comes with WSO2 products by default, hides all the complexity and presents you with a proxy to the back-end service. The stub generation happens during the project build process within the Maven POM files. It uses the Maven ant run plug-in to execute the wsdl2java tool.

You can also use the Java client program given here to invoke admin services. All dependency JAR files that you need to run this client are found in the /lib directory.

Authenticate the user

The example code below authenticates the user and gets the session cookie:

...

languagejava
Tip

To resolve dependency issues, if any, add the following dependency JARs location to the class path: <PRODUCT_HOME>/repository/components/plugins.

Tip

The the AuthenticationAdminStub class requires org.apache.axis2.context.ConfigurationContext as a parameter. You can give a null value there.

Generate the client stubs

After authenticating the user, give the retrieved admin cookie with the service endpoint URL as shown in the sample below. The service management servicename is ServiceAdmin. You can find its URL (e.g., https://localhost:<port>/services/ServiceAdmin) in the service.xml file in the META-INF folder in the respective bundle that you find in the /plugins directory.

...

languagejava

The following sample code lists the back-end Web services:

...

Include Page
shared:Calling Admin Services from Apps
shared:Calling Admin Services from Apps