Monday, December 09, 2013

WebLogic Server 12c RESTful Management Services

WebLogic Server (WLS) 12c delivers over 200 new features and enhancements.  With 12c, Oracle extended the WebLogic Management Framework with a set of RESTful management services.  These services provide a light-weight and flexible interface for monitoring WebLogic Server.  In this post, I will describe how to use this interface.

In 12c, Oracle added REST interface for managing WLS resources.  In 12.1.2, this interface allows administrators to monitor WLS resources (servers, clusters, applications, datasources) in any environment where a basic HTTP library is available for communicating with WebLogic admin server, and a DOM or JSON library exists for handling request/response messages.

Please refer to Administering Oracle WebLogic Server with RESTful Management Services for an overview of this feature and how to enable it.  If you don’t have access to the WebLogic admin console, refer to doc 1565067.1 to enable this using WLST.

Interface Design

WLS RESTful Management Service was designed based on a common REST design pattern (singular and plural nouns).  In WLS RESTful interface, there are two types of resources: a singular resource (item) and a set of resources (collection).    

As an example, if you want to see the collection of servers running in WLS, you'd use the following resource url:  http://localhost:7001/management/tenant-monitoring/servers

If you want to get information about a specific server, you'd use the following:
http://localhost:7001/management/tenant-monitoring/servers/AppServer1






Similarly, you'd use the same URLs to reference other resources:
http://localhost:7001/management/tenant-monitoring/clusters
http://localhost:7001/management/tenant-monitoring/clusters/{cluster name}
http://localhost:7001/management/tenant-monitoring/applications
http://localhost:7001/management/tenant-monitoring/applications/{application name}
http://localhost:7001/management/tenant-monitoring/datasources
http://localhost:7001/management/tenant-monitoring/datasources/{datasource name}

As of WLS 12.1.2, you can only use HTTP GET to retrieve information about resources described above. Compared to WLST, this is currently very limited.  In future releases of WLS, the list of supported resources and types of operations by WLS REST Management Service MAY be expanded.  This is not a guarantee or statement of product direction.  If you are interested in this feature, please tune in to WLS product management blog for future announcements.

Media-Types & Usecases

WLS RESTful Management Service supports “representation” of resources in HTML, XML, and JSON.  The representation refers to the format of the response message sent from WebLogic back to client.  

In the request message, client uses the “Accept” HTTP header to tell WebLogic how to encode the response message.  In the response message, WebLogic indicates the format of the response in Content-Type response header:

HTML Encoded Response








JSON Encoded Response


XML Encoded Response














So, what is the right format to choose?   This is an important question which depends on your usecase and the programming environment.

At the most basic level, as an example, you may be in a situation where you need to provide WLS server status for "level-1" operations support team.   All you have to do is to embed an HTML fragment in a custom monitoring dashboard to show the status of WLS servers.  For this scenario, the HTML encoded response may meet the  requirements without any programming efforts.

At the next level, the requirements may be a little more sophisticated.  After you call the service, you may need to parse the response and show only the desired values, and in a specific format. In this case, you may choose the JSON format to be used in a Javascript environment.

Finally, the requirements may be more sophisticated in terms of parsing, data validation, programming environment... and the usecase/application may even involve receiving data from other enterprise IT resources with limitations on data formats...  In this case, it may make sense to standardize on XML.


Sample Code

As I was getting ready to share some sample code in Python and Java to get you started, I found the following blog post http://www.oracle.com/technetwork/articles/soa/oliveira-wls-rest-javafx-1723982.html. It provides an excellent programming reference with sample code. 

Conclusion

With customers developing, testing, and managing applications and servers on-premise and in the cloud, WLS REST Management Service provides a uniform way for developing custom management solutions wherever the resources are running.   The interface is easy to understand and use, and it doesn't require any WLS runtime jar files to run...   


If you are interested to learn more about the new features in WLS 12c, take a look at this recent whitepaper by WLS product management. 

No comments: