WebLogic 12.2.1 RESTful Management

WebLogic 12.2.1 is out since Oracle Open World 2015 and comes with a new RESTful management interface.

  • RESTful management for 12.2.1 is a rewritten and different implementation.
    The previous two implementations supported only a small subset of JMX attributes, you could only read them, URLs and versioning were different.
  • The new URL format is:
     http://server:port/management/weblogic/latest/...

    if you scripts still contain /wls/ you are using the previous format.

  • Access to all WebLogic JMX MBeans and attributes is supported now.
  • Unlike in the previous version, RESTful management is turned on per default.
  • Unlike in the previous version, RESTful management is available on admin and managed servers.
  • The URL syntax is modelled after the WLST syntax (WLST tutorial  in this screencast).
  • A simple HTTP GET example (just type it into your browser), e.g. to retrieve name and state runtime values for a managed server named surf1:
    http://localhost:7001/management/weblogic/latest/domainRuntime/serverLifeCycleRuntimes/surf1?links=none&fields=name,state
    Response:
    { "name": "surf1", "state": "RUNNING" }
  • Another example to create a new server surf7 using curl:
    curl –v --user weblogic:welcome1 \
     -H X-Requested-By:MyClient \
     -H Accept:application/json \
     -H Content-Type:application/json \
     -d "{ name: 'surf7' } "
     -X POST \http://localhost:7001/management/weblogic/latest/edit/servers
  • Within the /edit subtree, edit sessions are implicit.
  • To manually start/cancel/activate edit sessions:
    /edit/changeManager/startEdit|cancelEdit|activate
  • Unlike the previous version of the RESTful management where HTTP OPTIONS was used to get a JSON form of possible values e.g. when creating a ressource, now /ressourceCreateForm is used, e.g. you can retrieve the values to create a server with the following HTTP GET:
    http://localhost:7001/management/weblogic/latest/edit/serverCreateForm
  • You can issue bulk requests, which runs a search of a set of specific JSON nodes and returns the results at once. As shown in the following example, an HTTP POST operation to the following URL
    http://localhost:7001/management/weblogic/latest/domainRuntime/search

    and using the following JSON as payload:
    json query

 

More?

More interesting facts about the RESTful management interface:

  • The RESTful management interface comes with very good error messages if something goes wrong.
    However, if  you try to update a property that cannot be overwritten, e.g. the server name of a managed server, it will be silently ignored. This is intended behaviour.
  • In the curl example above all(?)  -H options could be omitted (if you were a sloppy person, but I guess you aren’t). This is true for all HTTP verbs except HTTP POST, then X-Requested-By header is required to prevent cross-site request  forgery (CSRF).
  • You could also get access to all WebLogic MBeans and attributes using the highly popular open source Jolokia, as I explained already in 2012. Jolokia works for every major application server and also supports bulk requests. Ever wondered where the chili on my WebLogic book comes from?
    Jolokia also involves using real MBean names and is therefore more complicated for the typical WebLogic user. Also it involves adding Jolokia as a JVM agent, proxy, or WebLogic deployment. So most typical WebLogic users will be better off using the built-in RESTful management interface.
    I was planting some real spicy Jolokia this year. Two tiny crumbs of dried Jolokia is enough for a Chili con Carne with 500g of meat serving at least 3 people. Give it a try!

More about WebLogic 12.2.1?

Some more examples of the RESTful management, and also 11 additional “things” about WebLogic 12.2.1 are shown in a presentation I’ve done at Oracle Open World 2015:

Trackbacks

  1. […] for our joint customers. Don’t miss this great service opportunity! Thanks to Frank for the WebLogic 12.2.1 RESTful Management article and Andreas for the WebLogic 12.2.1 on Docker […]

  2. […] Another example to create a new server surf7 using curl: Read the complete article here. […]

Speak Your Mind

*