Level: Intermediate Barry Atkins (barrya@us.ibm.com), Advisory Programmer, IBM
25 Mar 2005 Explore a minimal implementation of Web Services Distributed Management (WSDM) specifications on a Blackberry™ device, demonstrating that you can implement WSDM and its requisite specifications on resource-constrained devices.
Introduction
The Web Services Distributed Management (WSDM) specifications define how management of any resource can be accessed through Web services protocols, and how Web services themselves can be managed using the same protocol. WSDM Management Using Web Services (MUWS) 1.0 defines how to represent and access the manageability interfaces of resources as Web services. This paper describes a proof-of-concept implementation of WSDM on a Blackberry™ device. Manageability is defined as the ability of a resource (in this case, a pervasive device) to be remotely managed. Manageability interfaces support control functions (stop, start, restart, shutdown, and so on) and monitoring functions (performance, state, and so on).
Why on a pervasive device?
A simple implementation of WSDM was implemented on a mobile device to demonstrate that you can implement WSDM and its requisite specifications on resource-constrained devices. WSDM, Web Services Addressing (WSA), Web Services Resource Framework (WSRF), Web Services Notification (WSN ), and Web Services Resource Lifetime (WSRL) were designed to be composable to allow for minimal implementation requirements in simple or constrained implementations. They also provide composable functionality required to support complex, large-scale systems.
What was implemented?
The following methods were implemented on the device:
From WS-ResourceFramework:
- Element[] GetResourceProperty(QName qname)
- Element[] SetResourceProperty (Update [])
- GetMultipleResourceProperties(QName qnames[])
From WS-BaseNotification:
The following properties were implemented for GetResourceProperty and GetMultipleResourceProperties:
Listing 1. Available properties
Serial Number Device serial number, prefixed by the manufacture
("RIM2100000A")
Date Device date
Time Device time
CodeModuleSize Total code size, in bytes, of all installed modules
BatteryLevel A percentage of battery life remaining
BatteryStatus "Charging", "Normal", "Too Hot", etc
AllocatedStorage Allocated storage, in bytes
FreeStorage Free storage, in bytes
Identity Device identity ("RIM" + device serial number)
ManageabilityCapability Returns capability URIs
|
Of the above, only Time and Date are mutable, and all others are read-only. Attempting to change the value of any of the other properties results in an InvalidResourcePropertyQNameFault.
The optional WSRF QueryResourceProperties method was not implemented; integrating an XPath interpreter was considered beyond scope of this implementation and unnecessary on resource-constrained devices.
The implementation was taken from the example implemented in the Emerging Technologies Toolkit 2.2 (ETTK), which was re-written to conform to the J2ME platform implemented on the Blackberry device. References to various J2EE classes were replaced with kSOAP or the J2ME supplied classes,
if available. The resulting code consisted of 52 source files in 9 packages, compiled to 118K (in 5 Blackberry-format .COD files). Of this, 63K was the kSOAP2 soap engine, 18K in UI and configuration, and 36K for the WSDM/WSRF/WS-N code.
Scenario components
The Blackberry device is inaccessible directly through an IP address, or hostname, so an intermediary known as the WirelessDeviceGateway (WDG) was implemented. The WDG hides logic for communicating with a variety of handheld devices on behalf of the caller. The WDG's URL is the Endpoint Reference (EPR) for Web services calls to the device. The URL contains the device's identifier which is comprised of the device's serial number appended to the manufacturer name (RIM):
http:\\myServer\WirelessDeviceGateway\RIM2100000A
The WDG forwards the request to the device and then returns the result. If the device is offline, a time-out occurs.
On the Blackberry device, a tiny SOAP server (using kSOAP2) receives the SOAP envelope, marshals the contents, invokes the requested function, and generates a returned soap envelope. This background server component runs transparently on the device and starts automatically when the device is powered on.
A second component, the WSDM Controller, provides simple feedback from the server and configuration of the server itself. The two processes communicate using a Blackberry-specific event mechanism.
Figure 1. WSDM controller application and menu
TinyWSDM controller main menu
- Stop server: stops the soap server.
- Start server: starts the soap server.
- WDGSetup: invokes the WirelessDeviceGateway dialog (to specify where the WirelessDeviceGateway resides).
- Subscriptions: shows all active subscriptions.
- Clear Subscriptions: destroys all subscriptions.
- Notify: forcibly generates a sample Notification message (for testing).
- Close: terminates the application.
When a Web service on the device is invoked, feedback is displayed as shown in Figure 2:
Figure 2. WSDM controller application
Running the scenario
A Web interface has been designed to test the hosted services on the device. The interface makes it easy to make changes, and the following three figures show how you can walk through the process of changing the time through the SetResourceProperty.
Figure 3. GetResourceProperty
Figure 4. GetMultipleResourceProperties
Figure 5. SetResourceProperty
Figure 6 shows the result on the device as a result of changing the time through SetResourceProperty.
Figure 6. SetResourceProperty on device
Figure 7. GetResourcePropertyDocument
Example management scenario
BobCo is having problems with the Blackberry devices being used for non-business reasons. Extra software is causing the business software for tracking inventory to remotely fail and then needing to be reinstalled. This is a problem in the field because field personnel don't have the skills (install/uninstall/configuration/debugging) and have to wait until they get to the office and then wait for support to reinstall the software. As a result, a new corporate policy forbids any non-corporate software on the Blackberry devices. Of course, it's not being obeyed, so an automated software inventory control system was installed using WSDM. This system detects new software installations and uninstalls any non-corporate software.
A subscription is generated for the topic CodeModuleSize_Change in Figure 8.
Figure 8. Subscription
Clicking the Notifications button opens the NotificationConsumer page in a new browser window:
Figure 9. Notification monitor
When the device owner installs or deletes an application, the CodeModuleSize property is modified. A notification is generated, and sent to the NotificationConsumer specified in the subscription for this topic.
Figure 10. Subscription notifications
Specifically, the device's CodeModuleSize property changes as the result of an application installation. This results in the generation of a ManagementEvent, containing a propertyValueChangeNotification event. The NotificationConsumer, upon receipt of this event, retrieves the list of installed applications on the device. This list is compared through a pre-configured policy to a list of legal and illegal applications. If an offending application (in this case, HelloWorld) is found, the NotificationConsumer invokes an UninstallApplication Web service on the device and the following pop-up is displayed :
Figure 11. Notification
The following is a sample MUWS ManagementEvent, indicating that the code module size has changed on the device RIM210000A:
MUWS Notification ManagementEvent
<ManagementEvent xmlns="">
<eventId>
http://pda.rim
</eventId>
<reportTime>
2005-02-16T18:50:54.300Z
</reportTime>
<SourceComponent>
<wsa:ComponentAddress xmlns:wsa=
"http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>
http://my.wirelessdevicegateway.com/WirelessDeviceGateway/RIM2100000a
</wsa:Address>
<wsa:ReferenceProperties>
</wsa:ReferenceProperties>
</wsa:ComponentAddress>
</SourceComponent>
<ReporterComponent>
<wsa:ComponentAddress xmlns:wsa=
"http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>
http://my.wirelessdevicegateway.com/WirelessDeviceGateway/RIM2100000a
</wsa:Address>
<wsa:ReferenceProperties>
</wsa:ReferenceProperties>
</wsa:ComponentAddress>
</ReporterComponent>
<PropertyValueChangeNotification>
<CodeModuleSize>
<oldvalue>
12351642
</oldvalue>
</CodeModuleSize>
<CodeModuleSize>
<newvalue>
12396123
</newvalue>
</CodeModuleSize>
</PropertyValueChangeNotification>
<Details>
<Topic>
CodeModuleSize_Change
</Topic>
<Device>
RIM2100000a
</Device>
</Details>
</ManagementEvent>
|
Subscriptions are destroyed through the Unsubscribe command, as shown in Figure 12.
Figure 12. Destroying a subscription
Existing subscriptions can also be dislplayed with the Show Subscriptions command, as you can see in Figure 13.
Figure 13. Viewing subscriptions
Conclusion
The WSDM 1.0 specifications have set forth the foundation for a management platform using Web services. WSDM can simplify remote systems management for a variety of devices in industry-standard, device-independent fashion. This proof-of-concept implementation demonstrates that you can implement these specifications on resource-constrained devices.
Resources - Get the following WSDM specfiications (some of which are still in committee or working draft):
-
Visit the WS Distributed Manangement TC.
- Find the following specifications on developerWorks:
- Learn more about KSOAP.
-
Download the IBM Emerging Technologies Toolkit from alphaWorks.
- Browse for books on these and other technical topics.
- Get involved in the developerWorks community by participating in
developerWorks blogs.
- The IBM developerWorks team hosts hundreds of technical briefings around the world which you can attend at no charge.
- Want more? The developerWorks SOA and Web services zone hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials on how to develop Web services applications.
About the author  | |  | Barry Atkins is an advisory software developer working for the Emerging Technologies Toolkit team with IBM. You can contact him at barrya@us.ibm.com. |
Rate this page
|