Sharepoint Webparts: License usage & Active Products

Facebook
X
LinkedIn

Subscribe to our blog

General

The OpenLM license monitoring and control tool employs various User Interfaces, from which Managers, Administrators and Users may extract data regarding applications’ license utilization and availability. These interfaces include the EasyAdmin web application, the OpenLM Mobile application, and the Agent client interface.

OpenLM also provides a comprehensive API for developers that enables users to add functionality to the system. API implementation capabilities are extensive, and may be applied for

  • Creating additional end user interfaces similar to EasyAdmin or the OpenLM Agent.

  • Including OpenLM Capabilities in other software products.

  • Assuring license availability in batch jobs.

  • Support of additional systems, etc.

SharePoint

Organizational portals are popular web applications that capacitate quick and easy development of informations system. These systems also enhance knowledge sharing within organizations and act as platforms for operational system.

Microsoft SharePoint is a specifically popular organizational portal. After receiving numerous requests for implementation tips we have decided to publish the following code sample as a possible implementation of OpenLM on a SharePoint platform.

This sample code is provided as is, as a full open source reference. It implements two of EasyAdmin’s popular report windows: Active Poducts & Lisence Usage.

OpenLM API

OpenLM has released a set of open APIs for users who wish to apply the capabilities embedded in the OpenLM software for use in their own applications. These APIs may accommodate querying of the license management system for current and historical license usage, querying available licenses’ status, and license report management.

The  “Active Products” and “License Usage” Webparts are implemented using these APIs.  They communicate with the OpenLM Server via XML-based request and response messages: The Server receives requests in the POST method, and returns the corresponding response in XML format.

SharePoint Code Sample

Scope

This code sample is brought as is, and serves as an example for implementing license management applications via OpenLM APIs.

Code sample

public static XElement GetResponse(string xmlRequest, string requestUrl)
{
HttpWebRequest httpRequest = (HttpWebRequest)System.Net.WebRequest.Create(requestUrl);
httpRequest.Method = “POST”;
Encoding encoding = System.Text.Encoding.GetEncoding(“utf-8”);
byte[] postData = encoding.GetBytes(xmlRequest.ToString());

// Set the content type of the data being posted.
httpRequest.ContentType = “text/xml”;

// Set the content length of the string being posted.
httpRequest.ContentLength = postData.Length;

Stream reqStream = httpRequest.GetRequestStream();
reqStream.Write(postData, 0, postData.Length);
reqStream.Close();

// Get Response
HttpWebResponse response = (HttpWebResponse)httpRequest.GetResponse();
Stream respStream = response.GetResponseStream();

// Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader readStream = new StreamReader(respStream, encoding);

XElement xmlResponse = XElement.Parse(readStream.ReadToEnd());

// Releases the resources of the response.
response.Close();
// Releases the resources of the Stream.
readStream.Close();

return xmlResponse;
}

Communication

Communication between the WebParts and the OpenLM Server is handled by a Helper class with the GetResponse Method:

  • GetResponse receives the service URL and the XML request string as parameters from both WebParts.

  • The Helper object compiles the request message, and sends it to the destined URL.

  • The same Helper object receives the corresponding response message and parses it.

“Active Products” and “License Usage” Webparts’ base

Both WebParts have two common properties; the Service URL and the XML Request. The ReportBaseWebPart class serves as the base class for the Active Products and License Usage WebParts. ReportBaseWebPart defines the two common properties (URL and XML), and validates them using the overridden method CreateChildControls.

Active Products WebPart

The ActiveProducts WebPart inherits from OpenLM’s custom class ReportBaseWebPart. This WebPart renders a grid with values obtained by the OpenLM Server’s response.  The CreateChildControl method builds a table containing this data.

In order to enhance the generated table, a jQuery plugin named dataTables (www.datatables.net) is used. This plugin enables filtering based on a free text search, sorting and paging with configurable page size.

License Usage WebPart

The LicenseUsage WebPart inherits from our custom class ReportBaseWebPart. This WebPart renders a chart with values obtained by the OpenLM Server’s response.  The CreateChildControl method builds a chart containing this data.

In order to render the chart, we used a jQuery plugin named Flot (http://code.google.com/p/flot/).

Screenshot

The following is a screenshot image of the two webparts, as they are seen in the Sharepoint environment.

Summary

The SharePoint webpart example demonstrates adding OpenLM to an organizational portal. There many options for configuring OpenlM via API, and we encourage our users’ community to implement it in-house and, if possible, share the code with the other users.

Our new users web forum contains a developers’ section that accommodates posting of code segments and questions that other users may be able to answer.

We believe that the use of these WebParts would contribute to the continuous monitoring of licenses with no additional effort, in organization that have implemented the Sharepoint portal. Moreover, additional functionality may be added in the same way, and OpenLM awaits the feedback of SharePoint users in order to enhance this ability.

Skip to content