| By Kuassi Mensah | Article Rating: |
|
| March 27, 2003 12:00 AM EST | Reads: |
26,572 |
"Si tu ne vas pas à Lagardère, Lagardère ira à toi!"
"Le Bossu", Alexandre Dumas
On guard! What do Web services have to do with a swordsman? Well, paraphrasing Alexandre Dumas's character, "if you don't go to Web services, Web services will come to you." Web services are pervading every layer of enterprise computing, from packaged e-business applications (e.g., ERP, CRM) to middle-tier (e.g., J2EE, .NET) and database infrastructure.
Web services promise easy access to remote content and application functionality using industry-standard mechanisms, without any dependency on the provider's platform, the location, the service implementation, or the data format.
The proliferation of structured and unstructured data and data logic in databases, the increasing momentum of XML as a data exchange format, the de facto acceptance of HTTP as a ubiquitous transport mechanism -in the context of heterogeneous environments - has aroused interest in database Web services. For example, many applications have significant amounts of business logic (such as PL/SQL packages) that run in the database. Database Web services allow organizations to leverage this existing investment.
Database Web services work in two directions: database as service provider, i.e. calling from the outside in, which lets client applications access the database via Web services mechanisms; and database as service consumer, i.e. calling from the inside out, which lets a SQL query or an application module in a database session consume an external Web Service. This article looks at the benefits of turning your database into a Web services player.
I'll explore how the database can be enabled both as a Web service provider and a consumer of external Web services. I'll also discuss future database support for Web services.
Database as Service Provider
Motivation
Why would you consider exposing database operations as Web services? What if you could expose existing stored procedures as Web services? When should you consider database Web services and when should you consider middle-tier (J2EE, .NET) Web services?
Many organizations are considering exposing their existing data and data logic that runs in the database as Web services (to both internal and external audiences). Consider Amazon Web services ( www.amazon.com/webservices) or Google Web services (www.google.com/apis/index.html). These let client applications discover and interact with their catalogs or search engines using standard Web services protocols (WSDL, SOAP). Generally, when considering the circumstances in which database Web services should be deployed, the rules of application partitioning across the middle tier and database should be observed. The business logic associated with Web services fits most naturally in the middle tier, and data logic in the database. This separation of concerns reduces application complexity; increases security, reuse, and data access efficiency; and localizes the impact of schema change.
Consider stored procedures as an example. Stored procedures are an essential database-programming model that allows a clean separation of data-centric logic that runs in the database from business logic that runs in the middle tier. Exposing a stored procedure as a Web service is a more cost-effective, more secure, cleaner, and more efficient choice than exposing a middle-tier component.
Architecture: The Service Provider Framework and the Service Invocation Mechanism
As part of their end-to-end Web services offerings, all major database vendors, including Oracle, IBM, and Microsoft, now provide access to their databases through Web services mechanisms (SOAP, WSDL, UDDI). Currently, they are all leveraging their existing middle-tier Web services framework. An example is shown in Figure 1.

IBM's DB2 also leverages the middle tier to handle SOAP encoding/decoding but uses a file-based approach for designating the database operations that are to be exposed as Web services. Microsoft's SQL Server utilizes the SQL Server 2000 Web Service Toolkit. A multistep process consisting of defining the database operations to be exposed as Web services, configuring a SOAP virtual name, and defining an IIS folder associating a SQLXML virtual name to the IIS subfolder is required.
Database APIs for Implementing Database Web Services
Due to the rapid evolution and maturing of Web services standards and technology, an exhaustive list of APIs and features provided by each database vendor is beyond the scope of this paper. However, I can give you a general idea of what database Web services you can expect to see:
Facing Web Services Issues
How do database Web services address common Web services issues such as data type mapping, security, transactions, and interoperability?
Database as Service Consumer
Motivation - Scenario
Relational databases are extending their storage, indexing, and searching capabilities to semistructured and nonstructured data, in addition to enabling federated data, e.g. from heterogeneous and external sources including Web services. The ability to call out Web services enables databases to track, aggregate, refresh, and query dynamic data, as well as data produced on demand such as stock prices, currency exchange rate, interest rate, IRS tax tables, scientific data, and weather information. For example, a database job can be scheduled to run at a predefined frequency to invoke external Web services that return inventory information from multiple suppliers and update a local inventory database. Another example is that of a Web Crawler: a database job can be scheduled to collate product and price information from a number of sources.
Architecture: The Service Consumer Framework
Consuming data from external Web services requires the following steps: building the SOAP message based on the Web service endpoint; sending the SOAP message over HTTP to the Web service endpoint; receiving the SOAP response; extracting resulting data from the SOAP message body, and dealing with faults and exceptions. Architectural issues you need to be aware of include:
Integration with SQL Engine:
SQL over SOAP
After dealing with the invocation style, you want to integrate the Web service information at the heart of the database - the SQL engine. I'll describe two mechanisms that allow you to accomplish this.

X := getTemp(zipcode) SELECT city_name, getTemp(zipcode) FROM ... WHERE ...
CREATE VIEW city_temp AS SELECT city_name, getTemp(zipcode) FROM ...
- Scenario 1: Calculating Aggregate Values: An application is implemented to aggregate some temperature values for a set of cities. The application can be implemented as a store procedure that requests the current temperatures of selected cities by invoking a public Temperature Web service with the zip codes of the selected cities. Aggregate functions, such as max, min, and avg, can be applied to the resulting data set.
- Scenario 2: Collating Data: An application is designed that collates, at predefined time intervals, the temperature for a set of cities and stores this information in a local database. This application can be implemented by a database batch job that calls the Temperature Web service with the Zip codes of all the cities and stores the result data in a local database table.
An architecture supporting both of these scenarios is shown in Figure 3.

What's Next for Database Web Services
Web services have received significant attention and there is a great deal of industry excitement around the opportunities afforded by them. While most of this attention has focused on middle-tier Web services, an increasing interest in database Web services has recently emerged as organizations reflect on their existing investments in data and stored procedures. So what can you expect in the future? We're likely to see increased integration with tools and frameworks, support for more complex data types, and convergence with Grid technologies. Tools will begin to support database Web services coupled with emerging Web services standards around choreography and orchestration, and we will also start to see SOAP bindings for protocols other than HTTP (e.g., FTP, vendor-specific messaging protocols).
As complex and hierarchical data types are widely used, you can also expect cross-vendor interoperability for hierarchical data shapes such as JDBC WebRowset and ADO Datasets, so as to allow data to be exchanged between Web services consumers and producers without requiring XML Schema Definition information. You can also expect a convergence between database Web services and (data-centric) Grid data services for service description and publication, service invocation, event subscription, and notification.
Conclusion
Database Web services leverage your existing server-side infrastructure, allowing you to use your database as both service provider and service consumer. I showed you how we at Oracle allow you to turn your database into a Web service provider, thus enabling you to share data and metadata across corporate intranets and access the database operations, e.g. triggers, through SOAP requests. I also explained how you can turn your database into a Web services consumer to access dynamic data. Finally, I gave you an overview of future database Web services capabilities.
Published March 27, 2003 Reads 26,572
Copyright © 2003 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Book Review: Sams Teach Yourself Java in 24 Hours
- OpenOffice.com Lives
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?
















