When you're using Apache Muse to create a WSDM-compliant interface for a manageable resource, what steps should you follow to design your Web Services Description Language so you can translate
httpd concepts into those in the WS-Resource Framework (WSRF) and WSDM specifications?
- Understand the state model (resource properties document).
- Decide which resource operations the Web services interface should have.
- Use the template WSDL provided by the Muse SDK to build the actual WSDL XML document.
- Add the resource properties and operations that are specific to HTTP servers.
These steps are from "Creating a WSDM interface for an HTTP server using Apache Muse," in which you'll learn how Apache Muse can be used to create a WSDM-compliant interface for a manageable resource; more specifically, how to design the Web service interface for the resource, generate code for the implementation, and deploy the code as a Web application. (For more resources on crafting a WSDM interface, see the sidebar.)
First, understand the state model (resource properties document), the first part of any WSRF-based WSDL. All Web services that are based on WSRF must have a resource properties document:
- WSRF and WSDM both define a number of standard properties (many of which are optional) that are useful to managed resource developers. Like ResourceId (a unique identifier for each instance of a resource type); ManageabilityCapability (a collection of URIs communicates to remote clients what management features the Web service supports); Caption, Description, and Version (provides human-readable text that help management clients sort and present the resources more clearly); and OperationalStatus (a simple enumeration that gives a high-level report on the resource's ability to service requests using the values Available, PartiallyAvailable, Unavailable, and Unknown). These properties all revolve around the common themes of identification and description; their definitions and semantics will adhere to the standards.
- There are also many pieces of information in the httpd installation that could be useful to a management client, things that are specific to HTTP servers (and all found in the httpd.conf file). Plus information that you wouldn't want exposed using Web services, so every property in httpd.conf shouldn't be considered a resource property. Three HTTP properties to focus on include ThreadsPerChild (the number of request-handling threads in each httpd process), Listen (the port number that the server is listening on), and ServerName (the full host name and port that the server uses to identify itself).
Decide which resource operations the Web services interface should have. They're used to manipulate the state model and also come in two flavors:
WS-* operations. The minimal set of operations required by WSRF has just one operation --
GetMultipleResourcePropertiesdepending on how much information you want to get). Another good one to add to the list is
GetMetadata, which provides a robust way for clients to resolve a resource's WSDL document.
HTTP operations like
Stopare really necessary because a management client would most probably need to control the availability of the server if it were in charge of maintaining and optimizing it. These two operations can be mapped to the execution of the httpd application and termination of the same process, respectively.
Use the template WSDL provided by the Muse SDK to build the actual WSDL XML document for the httpd resource based on Steps 1 and 2; the template includes the WS-* definitions you need. You can customize it by:
- Give the WSDL file a meaningful name, such as "http-server.wsdl".
- Use your text editor to perform a search-and-replace on the current target namespace (
http://ws.apache.org/muse/test/wsrf). Change the namespace to
- Use your text editor to perform a search-and-replace on the current WSDL name (
WsResource). Change the name to
- At the bottom of the WSDL, change the
locationattribute on the
<wsdl-soap:address/>element to be
- Delete all of the resource properties that are not being used by your httpd resource. These include
QueryExpressionDialect, and the four topic-related properties.
- Delete all of the
<wsdl:operation/>elements that are not being used by your httpd resource. These include
Finally, add the resource properties and operations that are specific to HTTP servers.
Hint: Don't confuse having no type ("void" in Java™ code) with allowing open content. The latter requires a type of
xsd:anyType. Muse's code generation tool will map parameters of
xsd:anyType to the
org.w3c.dom.Element type from the JDK, giving you the raw XML content to work with in your Java method. If you don't want any parameters, leave the type blank.
Your WSDL is complete.
The Apache Muse Web site provides all of the OASIS standards that the project supports.
Apache Axis2 has WS-Security support that you can use to add authentication to the application built in this tutorial.
Be sure to take the the introductory tutorial that is part of the Muse package before you attempt this tutorial if you've never used Muse.
In the developerWorks Autonomic computing zone you'll find links to such resources as articles, tutorial, standards and specs, and downloadable tools like the newly release Build to Manage Toolkit for Problem Determination.
The developerWorks SOA and Web services zone provides further resources on WS standards and their impact on technologies.
Get products and technologies
Download Apache Muse 2.0.0. to get the SDK used in this tutorial.
Download Apache HTTP Server so that you can run the application built with this tutorial.
- Participate in the discussion forum.
Test drive a developerWorks community blog, join in a developerWorks forum, or listen to a developerWorks podcast to keep up with the latest in cutting-edge technologies.
Kane Scarlett is the editor of the Autonomic computing technology zone for developerWorks. His past publishing work was with such magazines as Unix Review, Advanced Systems, and the -World publications (Java-, Sun-, NC-, Linux-), as well as some little oddball journals like National Geographic Magazine.