G O B E Y O N D C O N V E N T I O N WORF: Developing DB2 UDB based Web Services on a Websphere Application Server Kris Van Thillo, ABIS Training & Consulting
©2003 BMC SoftwareJune 3, Agenda J2EE and Web Services Introduction › About Web Services › About Stored Procedures Architecting Web Services › Understand application requirements › The server component model - the client invocation model › WSDL, SOAP and UDDI constructs DB2 Stored Procedures and Web Services › WORF › DB2 XML Extender › Web Services
G O B E Y O N D C O N V E N T I O N Introduction Web Services and Stored Procedures
©2003 BMC SoftwareJune 3, Web Services - Definition Web Services are “Software applications identified by a URI, whose interfaces and bindings are are capable of being defined, described and discovered by XML artifacts, supporting direct interactions with other software applications using XML based messages via internet-based protocols.”...
©2003 BMC SoftwareJune 3, Web Services - Standards and based on open standards XML - eXtensible Markup Language SOAP - Simple Object Access Protocol WSDL - Web Services Description Language UDDI - Universal Description, Discovery and Integration
©2003 BMC SoftwareJune 3, Webservices - Execution
©2003 BMC SoftwareJune 3, Web Services - Execution Step 1: Define and build Web Service (method signature) function/operation(s), parameters return value, errors/exceptions Step 2: Deploy Web Service to SOAP router deployment descriptor Step 3: Create client application Java calls SOAP API Step 4: Execute the client application
©2003 BMC SoftwareJune 3, Web Services - Why? Advantages: loosely coupled and coarse-grained service granularity programming language independent, interoperable transport independent mutiple invocation styles: static or dynamic multiple communication styles: synchronous or asynchronous open, extensible, standards based: based on XML composable
©2003 BMC SoftwareJune 3, About Stored Procedures... Stored Procedures
©2003 BMC SoftwareJune 3, Advantages of Stored Procedures Faster execution Reduced network traffic Modular programming Increased security
©2003 BMC SoftwareJune 3, Writing Stored Procedures Languages: Java, C,… Generation with GUI: › Stored Procedure Builder (v7) › Development Center (v8) SQL/PL DB2 UDB v8 supports the dynamic CALL statement
G O B E Y O N D C O N V E N T I O N Architecting Web Services
©2003 BMC SoftwareJune 3, Common Web Service Architectures
©2003 BMC SoftwareJune 3, Server component model Client invocation model Server component model › Request-Response and RPC paradigms: use solutions with basic synchronous blocking behaviour e.g. Java classes, EJBs, stored procedures › Fire and Forget: JMS architecture and MDBeans for asynchronous behaviour Client invocation model › Static Proxy, static proxy generated, based on WSDL › Dynamic Proxy › Dynamic Invocation Interface
©2003 BMC SoftwareJune 3, WSDL, SOAP, UDDI Constructs SOAP provides a myriad of constructs! Consider: usage styles › SOAP ‘RPC’ style › SOAP Document style encoding styles › encoded › literal
G O B E Y O N D C O N V E N T I O N Stored Procedures and Web Services
©2003 BMC SoftwareJune 3, WORF - Basic Architecture WORF: a piece of software plugged in the Websphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareJune 3, The DB2 XML Extender Offers … › Stored Procedures › Triggers › User Defined Functions (UDF) › User Defined Datatypes (UDT) › Supporting tables … to extend DB2 functionality!
©2003 BMC SoftwareJune 3, Two methods (i) XColumn Column data = XML documents DB2 used as XML document repository Validation of XML docs Storing XML docs Search through XML docs
©2003 BMC SoftwareJune 3, Two methods (ii) XCollection DB2 used as database (no XML in DB2) XML is transport language Validation of XML docs Decompose XML docs into data Compose XML docs from data
©2003 BMC SoftwareJune 3, DADs XML document › Validate › DTD-id › Method › Detailed description of data mapping: DB2 vs. XML
©2003 BMC SoftwareJune 3, DB2 Web Services WORF: software plugged in the WebSphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareJune 3, Web Service Object Runtime Framework (WORF) Provides for: › Resource-based deployment and invocation, i.e. DADX based optionally other resources that help define the web service › Automatic service redeployment › Automatic WSDL and XSD generation › Automatic documentation › Automatic test page generation
©2003 BMC SoftwareJune 3, WORF configuration files description of deployed service servlet mapping service specific config database specs engine
©2003 BMC SoftwareJune 3, DADX Document Access Definition eXtension › XML document › a DADX for each Web Service › Web Service meths: DADX operations › Web Service documentation › Query Description SELECT pfname, plname FROM db2.persons call db2.InPers(:lname, :com)
©2003 BMC SoftwareJune 3, Possible DADX operations / DB2 manipulations › select › insert › update › delete › call › retrieveXML › storeXML SQL based queries XML based queries
©2003 BMC SoftwareJune 3, SOAP request processing by WORF Processing sequence: › loads the DADX › optionally loads a DAD file › replaces query parameters › connects to DB2 › runs the SQL statement › commits the database transaction › formats the result into XML › returns the response in a SOAP envelope
©2003 BMC SoftwareJune 3, DB2 Web Services WORF: software plugged in the WebSphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareJune 3, Why will Web Services Succeed? Because: › Implementation de-coupled from interface any language open standard transport ‘distributed’ technology › Optimized for Internet standard based › ‘No’ assumptions about technology at either side of the chain › Backed by key software vendors: IBM, Oracle, MS, etc.