Most discussions of DB2 Web services position DB2 as a service provider. However, DB2 applications also can consume services provided by external Web application servers—either automatically, through a wrapped User Defined Function (UDF) triggered by a script or a stored procedure, or on demand in applications written in any programming language that supports SQL. Small projects that enhance existing DB2 applications to consume services from an intranet, extranet, or the Web can quickly show tangible results. At the same time, they leverage the enormous investments being made by Web service providers— up to $4.6 billion by 2013, according to a Forrester Research report on enterprise Web 2.0 technologies.
The host DB2 database adds industrial- strength security, recoverability, and data integrity to data consolidated from multiple sources, while data consolidation adds value to your proprietary data assets. Moreover, the services consumption approach provides developers and DBAs with a fast path to familiarity with DB2 Web services technology.
Web Services UDFs
IBM added support for DB2 Web services in the XML extensions for DB2 Version 8. Native XML and Web services support followed in DB2 9. In both versions, a set of IBM-supplied DB2 UDFs provide a SOAP messaging client interface over the HTTP transport protocol (see Figure 1).
Common to these UDFs is the function db2xml.soaphttp, which:
• Composes a SOAP request message based on parameters you supply
• Posts that request over HTTP to the desired service endpoint
• Receives the SOAP response message from the service
• Strips the SOAP envelope from the response
• Returns the content of the SOAP response body to your DB2 application.