|
SYS-CON.TV Webcasts
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Top Links You Must Click On
Feature Java Feature: Putting a Face on Web Services and SOA
It's easier than you think
May. 1, 2006 03:00 PM
Service-Oriented Architecture (SOA) is a hot topic among analysts, CIOs, and technology marketers, but the path from high-level architectural principles to programming a functioning, real-world service isn't always clear, especially since, in the end, you still need to create a clean user interface that's as flexible as the services it consumes.
Instead of building big monolithic applications, developers can build more agile services that can be deployed and reused across an organization for different applications and processes. This allows for better reuse of software functionality, as well as for increased flexibility because developers can evolve the implementation of a service without necessarily affecting the clients of that service. To this end, the main requirement of an SOA is that the interface to the services is decoupled from the implementation. This separation provides the central benefit to SOA, both from a programmatic perspective and a financial one. Existing systems, both legacy and modern, internal to the company and external, can be exposed and consumed as services, simplifying the task of development.
A Face for SOA JavaServer Faces (JSF) complements SOA by allowing for an easy way to add the last piece of the SOA puzzle: a human-usable interface. JSF is a standard J2EE technology providing a component-based approach to user interface development, as well as adherence to the model-view-controller architecture that Jakarta Struts helped promote as the standard Web application architecture (Figure 1). JSF components can be likened to services in SOA: they encapsulate many of the common requirements and commands of a Web-based user interface. Instead of having to programmatically build HTML tables or write data validation in JavaScript, components can provide all of this functionality, enabling a developer to simply drop a component onto a page and set its properties. Even more compelling, the more comprehensive JSF component sets, like Oracle's ADF Faces, are built with multiple sets of renderkits that allow the components to be consumed by many different clients and devices, including PDAs, mobile phones, Telnet, and IM.
Service-Oriented Architecture Details The services that comprise the building blocks of an SOA application have a common characteristic: a public interface made up of exposed methods that can be consumed by other parts of the application. The public interface can be implemented in any technology (.NET, J2EE, COBOL, PL/SQL, etc.). By far the most common type of service used in SOA is Web Services. However Web Services by themselves don't provide the basic infrastructure you'd expect in a programming language such as exception handling and state maintenance. To orchestrate a set of Web Services into a business process requires either writing a great deal of low-level code or the use of the Business Process Execution Language (BPEL). BPEL is an emerging OASIS (Organization for the Advancement of Structured Information Standards) standard that enables the orchestration of Web Services. While the BPEL language is represented by a somewhat complex XML schema, there are visual BPEL tools, like Oracle's BPEL Designer, that simplify the orchestration of Web Services into business process flows using a drag-and-drop, declarative development environment.
JavaServer Faces and SOA - A Simple Example Consider an example application that consists of both a JSF user interface and a backend BPEL process flow. The JSF user interface includes an entry form for personal information, most importantly a Social Security number. The JSF application then submits the user-provided Social Security number to the BPEL process that shops for the lowest loan rate from a set of independent financial institutions that offer loan rate quotes via Web Services (Figure 2). Once the lowest rate is determined, it's returned back to the JSF application and reported to the user. For simplicity our example BPEL choreography consists of two Partner Links based on the Web Services that provide two competing loan rates.
Building the BPEL Process Flow
Building the Loan Rate Services
As an example, here is the core source code for the EzLoans Web Service:
package com.jdj.ezloan; As you can see, the method getDailyRate( ) simply returns the value of the dailyRate that is hardcoded to a value of 5.6. To expose this method as a Web Service, an IDE can quickly generate the necessary code, which will expose the method as a Web Service when deployed to an application server. In a similar fashion the CheapLoans Java class with a method getLoanRate( ) can also be exposed as a Web Service. Once the necessary plumbing code for the Web Services has been created, the EzLoans and Cheaploans Web Services can be deployed to a J2EE app server such as Oracle Containers for J2EE (OC4J). After successful deployment, the services can be viewed and tested to make sure they can process requests.
Orchestrating the Services - Building a BPEL Flow
Reader Feedback: Page 1 of 1
Your Feedback
Enterprise Open Source Magazine Latest Stories . . .
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||