Arulazi is a senior software engineer for Hewlett-Packard, India. He can be reached at [email protected].
Using the WS-I Basic Profile 1.0 in Development
The Web Services-Interoperability (WS-I) organization is an open industry initiative promoting web services interoperability across platforms, operating systems, and programming languages. This initiative is supported by vendors ranging from BEA Systems, IBM, and Microsoft, to Bowstreet, Oracle, and Sun Microsystems, among others. WS-I (http://www.ws-i.org/) is gaining momentum, as the need for interoperable web services becomes more and more apparent.
With the approval of the Basic Profile 1.0 specification (http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a.htm), WS-I has passed a significant milestone in its commitment towards interoperability. Moreover, WS-I has released the final version of its Testing Tools Implementation for the Basic Profile Version 1.0. These tools (http://www.ws-i.org/implementation.aspx) help you determine whether your web services are compliant to the WS-I Basic Profile, which considers the core set of specificationsXML 1.0, XML Schemas Parts 1 and 2, HTTP/1.1, WSDL 1.1, UDDI 2.0, and SOAP 1.1. In this article, I examine the WS-I Basic Profile and use the WS-I Testing Tools to test WS-I conformance of the publicly hosted Catalogue Web Service.
WS-I Motivation
With the rapid adoption of web services, service providers and consumers are encountering interoperability issues due to the adoption of many web-service specifications that are still works in progress. Even as you read this, the WS-I is gathering input from vendors who want a smooth adoption of this technology. With the requirements from industry and practitioners, the WS-I consortium has delivered key specifications and tools that are useful in certifying as "WS-I Compliant." Among the current WS-I deliverables are profiles, use cases and usage scenarios, sample code and applications, and test suites and supporting materials that help you certify your web services or products as interoperable.
For instance, Figure 1 illustrates the components of a typical Service-Oriented Architecture (SOA). In the Basic Profile, WS-I addresses the standards that describe services through WSDL, discover services through UDDI, and invoke them through SOAP/HTTP. The interactions between these components are standardized through protocols such as XML and HTTP.
WS-I Profile Conformance
Conformance adheres to the specifications that make up a profile's "scope" and "requirement." Scope defines the versioned specifications that are referenced in defining the profile, while requirement defines the rules that web services should adhere to meet the profile's standard for interoperability. Table 1 lists some of the basic requirements captured in the Basic Profile 1.0 specification.
There are two types of conformance:
- Conformance of artifacts, the basic level of conformance. The three types of artifacts considered to be the primary elements of any web service are: Message, SOAP/HTTP messages; Description, WSDL descriptions; and Regdata, UDDI tModels.
- Conformance of services, consumers, and registries is a higher level of conformance and defines that the service deployed should produce or consume only conformant artifacts defined as part of basic conformance. Also, wherever multiple conformant artifacts are possible, the service must be able to consume all. The types that are defined under this level of conformance are: Instance, software that implements a wsdl:port or uddi:bindingTemplate; Consume, software that invokes an Instance; Registry, a UDDI registry capable of managing Regdata; Sender, software that generates messages; and Receiver, software that consumes messages.
WS-I Testing Tools
WS-I Testing Tools evaluate the web services for Basic Profile conformance by capturing the interaction between the web service and its consumers. The core components of testing-tools architecture are the monitor, analyzer, and configuration files. The responsibility of the Monitor component (Figure 2) is to capture messages and record them for future analysis. The analyzer component (Figure 3) confirms that the web-service artifacts comply with the Basic Profile. The analyzer verifies the recorded messages for profile conformance. In addition to this, there are configuration files (such as monitorConfig.xml, analyzerConfig.xml, and BasicProfileTestAssertions.xml) that control the execution of the test environment. The analyzer generates a conformance report that has the complete analysis of the web service being tested. This report helps in certifying web-service compliance to the Basic Profile.
You can download the WSI-Testing Tools 1.0 (available for both C# and Java) from http://www.ws-i.org/implementation.aspx and extract the distribution to your hard drive (for instance, C:\wsi-test-tools). For the purposes of illustration, I use here the Java implementation, and to test an example WSDL artifact for conformance, I use the HP Catalogue Web Service (WSDL document available at http://www.lixusnet.com/lixusnet/ HPcatalog.jws?wsdl).
Listing One is a sample monitor configuration file that logs the interactions between the HP Catalogue Web Service and the client. The log file contains the request to the web service and response from the web service. This is an XML document, which can be viewed in HTML format with the supplied XSL document (C:/wsi-test-tools/common/xsl/log.xsl).
The analyzer determines whether the artifacts conform to the basic profile with the help of test assertions. One or more basic profile requirements form the test assertion. In this example, I consider the HP Catalogue Web Service description to be verified for conformance. Listing Two is the sample configuration file for analyzer. The input to this tool is the location of the WSDL document for the web service and its service and port names. The analyzer processes this artifact against the test assertions document and produces the conformance report. This report (available electronically; see "Resource Center," page 5) is an XML document and can be viewed as HTML with the supplied XSL document (C:/wsi-test-tools/common/ xsl/report.xsl).
The conformance report for this artifact showed "failed," thus, the web service failed to comply with the test assertions WSI2108 (R2110, R2111) and WSI2406 (R2706, R2723), which target the corresponding basic profile requirements. (See BasicProfileTestAssertions.xml for more information about these failing test assertions.)
There are five result types for a test assertion:
- Passed, the test assertion of the input entry succeeded without any errors.
- Failed, the test assertion of the input entry failed with errors.
- Warning, the input entry failed the test assertion, but the test assertion indicated that it was "recommended."
- NotApplicable, the test assertion is not relevant to this input entry.
- MissingInput, the input entry is missing or unqualified.
Conclusion
Web-service developers need to ensure that they follow WS-I requirements to achieve conformance to the Basic Profile. Today, you can certify your web services with the tools provided by WS-I. In the future, development environments will be smart enough to create web services that fulfill these profile requirements, thus increasing productivity and reducing time to deliver interoperable web services.
DDJ
Listing One
<wsi-monConfig:configuration xmlns:wsi-monConfig= "http://www.ws-i.org/testing/2003/03/monitorConfig/"> <wsi-monConfig:comment> This configuration file is used to test the WS-I sample applications running on a single system. </wsi-monConfig:comment> <wsi-monConfig:logFile replace="true" location="log.xml"> <wsi-monConfig:addStyleSheet href= "C;/wsi-test-tools/common/xsl/log.xsl" type="text/xsl"/> </wsi-monConfig:logFile> <wsi-monConfig:logDuration>600</wsi-monConfig:logDuration> <wsi-monConfig:cleanupTimeoutSeconds>3</wsi-monConfig:cleanupTimeoutSeconds> <wsi-monConfig:manInTheMiddle> <wsi-monConfig:redirect> <wsi-monConfig:comment>This is a redirect for HP Catalog service. </wsi-monConfig:comment> <wsi-monConfig:listenPort>4040</wsi-monConfig:listenPort> <wsi-monConfig:schemeAndHostPort> http://www.lixusnet.com</wsi-monConfig:schemeAndHostPort> <wsi-monConfig:maxConnections>1000</wsi-monConfig:maxConnections> <wsi-monConfig:readTimeoutSeconds>15</wsi-monConfig:readTimeoutSeconds> </wsi-monConfig:redirect> </wsi-monConfig:manInTheMiddle> </wsi-monConfig:configuration>
Listing Two
<wsi-analyzerConfig:configuration name="Sample Basic Profile Analyzer Configuration" xmlns:wsi-analyzerConfig= "http://www.ws-i.org/testing/2003/03/analyzerConfig/"> <wsi-analyzerConfig:description> This configuration file is for HP catalog service which is deployed as an axis service at http://www.lixusnet.com/lixusnet/HPcatalog.jws. </wsi-analyzerConfig:description> <wsi-analyzerConfig:verbose>false</wsi-analyzerConfig:verbose> <wsi-analyzerConfig:assertionResults type= "all" messageEntry="true" failureMessage="true"/> <wsi-analyzerConfig:reportFile replace= "true" location="report.xml"> <wsi-analyzerConfig:addStyleSheet href= " C;/wsi-test-tools/common/xsl/report.xsl" type="text/xsl"/> </wsi-analyzerConfig:reportFile> <wsi-analyzerConfig:testAssertionsFile> C;/wsi-test-tools/common/profiles/BasicProfileTestAssertions.xml </wsi-analyzerConfig:testAssertionsFile> <wsi-analyzerConfig:logFile correlationType="endpoint"> log.xml </wsi-analyzerConfig:logFile> <wsi-analyzerConfig:wsdlReference> <wsi-analyzerConfig:wsdlElement type="port" parentElementName="HPcatalogService" namespace="http://www.lixusnet.com/lixusnet/HPcatalog.jws"> HPcatalog </wsi-analyzerConfig:wsdlElement> <wsi-analyzerConfig:wsdlURI> http://www.lixusnet.com/lixusnet/HPcatalog.jws?wsdl </wsi-analyzerConfig:wsdlURI> </wsi-analyzerConfig:wsdlReference> </wsi-analyzerConfig:configuration>