Infrastructure at your Service

Pascal Brand

Using WebLogic 12C RESTful interface to query a WebLogic Domain configuration

WebLogic 12.2.1 provides a new REST management interface with full accesses to all WebLogic Server resources.
This new interface provides an alternative to the WLST scripting or JMX developments for management and monitoring of WebLogic Domains.
This blog explains how the RESTful interface can be used to determine a WebLogic Domain configuration and display it’s the principals attributes.

For this purpose, a Search RESTful call will be used.
The RESTful URL to point to the search is: http://vm01.dbi-workshop.com:7001/management/weblogic/latest/edit/search
This search RESTful URL points to the root of the WebLogic Domain configuration managed beans tree.

The search call is a HTTP POST and requires a json structure to define the resources we are looking for.

{
    links: [],
    fields: [ 'name', 'configurationVersion' ],
    children: {
        servers: {
            links: [],
            fields: [ 'name','listenAddress','listenPort','machine','cluster' ],
            children: {
                SSL: {
                    fields: [ 'enabled','listenPort' ], links: []
                }
            }
        }
    }
}

The json structure above defines the search attributes that is provided in the HTTP POST.
This command searches for the WebLogic Domain name and Version.
Then for the servers in the children’s list for which it prints the name, listen port, machine name and cluster name if this server is member of a cluster. In the servers childrens list, it looks for the SSL entry and displays the SSL listen Port.

To execute this REST url from the Unix command line, we will use the Unix curl command:

curl -g --user monitor:******** -H X-Requested-By:MyClient -H Accept:application/json -H Content-Type:application/json -d "{ links: [], fields: [ 'name', 'configurationVersion' ], children: { servers: { links: [], fields: [ 'name', 'listenPort','machine','cluster' ], children: { SSL: { fields: [ 'listenPort' ], links: [] }} } } }" -X POST http://vm01.dbi-workshop.com:7001/management/weblogic/latest/edit/search

Below is a sample of the results provided by such command execution:

{
    "configurationVersion": "12.2.1.0.0",
    "name": "base_domain",
    "servers": {"items": [
    {
          "listenAddress": "vm01.dbi-workshop.com",
          "name": "AdminServer",
          "listenPort": 7001,
          "cluster": null,
          "machine": [
                 "machines",
                 "machine1"
          ],
          "SSL": {
                 "enabled": true,
                 "listenPort": 7002
          }
   },
   {
          "listenAddress": "vm01.dbi-workshop.com",
          "name": "server1",
          "listenPort": 7003,
          "cluster": [
                 "clusters",
                 "cluster1"
          ],
          "machine": [
                 "machines",
                 "machine1"
          ],
          "SSL": {
                 "enabled": false,
                 "listenPort": 7013
          }
  },
  {
          "listenAddress": "vm01.dbi-workshop.com",
          "name": "server2",
          "listenPort": 7004,
          "cluster": [
                "clusters",
                "cluster1"
          ],
          "machine": [
                "machines",
                "machine1"
          ],
          "SSL": {
                "enabled": false,
                "listenPort": 7014
          }
  },
  {
         "listenAddress": "vm01.dbi-workshop.com",
         "name": "server3",
         "listenPort": 7005,
         "cluster": null,
         "machine": [
                "machines",
                "machine1"
         ],
         "SSL": {
               "enabled": false,
               "listenPort": 7015
         }
  }
]}
 

Leave a Reply


+ 1 = four

Pascal Brand
Pascal Brand

Consultant & Middleware Technology Leader