RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Applying Design Issues and Patterns in Web Services  : Page 4

Although the model of Web service interoperability is straightforward, it introduces new development practices and methodologies that can be difficult to learn. However, it can be a short-lived hurdle if you recognize certain patterns to design issues.

Leveraging Well-Known Design Patterns
One area where Web service and object-oriented designs are comparable is in the use of patterns. In his book "Analysis Patterns" (Addison-Wesley), Martin Fowler defines a pattern as "an idea that has been useful in one practical context and will probably be useful in others."

Patterns are good constructs for designing Web services. In particular, there are several well-known patterns that apply, such as can be found in "Core J2EE Patterns: Best Practices and Design Strategies" (Prentice Hall PTR).

  • Adapter or Wrapper: Used to expose internal application functionality with a different interface
  • Façade: Used to encapsulate complexity and provide coarse-grained services
  • Proxy: Used as a surrogate for another object or service.
The Wrapper pattern leverages the popular Adapter pattern. The basic idea is to convert a component's interface into another interface that the client expects. This would typically be used to provide some compatibility with the client. The adapter pattern can be used to expose existing technologies as Web services. For example, if you are running on a J2EE platform and have a need to interact with a C++ component, you may wrap the C++ component with JNI code, and then expose that Java interface as a Web service using the available Web services tools.

The Façade pattern is a familiar approach to building coarse-grained services. In J2EE, the Façade was represented by a session bean, while the fine-grained components were typically entity beans. For Web services, the same approach can be leveraged. The idea is to take existing components that are already exposed and encapsulate some of the complexity into high-level, coarse-grained services that meet the specific needs of the client. In using this approach, you can enhance overall performance of the Web services interactions and centralize infrastructure services such as security and transactions. Figure 4 shows the relationships between an application's presentation and business tiers using the Façade pattern.

Figure 4: The Fa

Chris Peltz is a software consultant in HP's Developer Resource Organization, providing consulting on J2EE, Web services, and mobile architectures. His September presentation at HP World 2002 in Los Angeles outlined practical steps for making a Web services pilot successful. He will speak later this year at HP Software Universe in Lisbon, Portugal. He has more than 10 years of experience in object-oriented development, user interface design, Web development, and J2EE architectures. He can be reached at chris.peltz@hp.com.
Email AuthorEmail Author
Thanks for your registration, follow us on our social networks to keep up-to-date