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 SoftwareApril 18, 20232
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
IntroductionWeb Services and Stored Procedures
©2003 BMC SoftwareApril 18, 20234
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 SoftwareApril 18, 20235
Web Services - Standards
andbased 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 SoftwareApril 18, 20236
Webservices - Execution
©2003 BMC SoftwareApril 18, 20237
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 SoftwareApril 18, 20238
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 SoftwareApril 18, 20239
About Stored Procedures ...
Stored Procedures
©2003 BMC SoftwareApril 18, 202310
Advantages of Stored Procedures
• Faster execution
• Reduced network traffic
• Modular programming
• Increased security
©2003 BMC SoftwareApril 18, 202311
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 SoftwareApril 18, 202313
Common Web Service Architectures
Request /Response
SOAP request sent to receiverReceiver processesSOAP response sent back to sender
Non component basedapplicationsSimple Java
RPC SOAP request send to haveoperation executed on remote objOperation executed on the objectResult returned as a SOAP response
Component basedapplications, eg.Stateless session beans
Fire and Forget Sender sends SOAP request toreceiver(s)Sender does not block
Messaging
©2003 BMC SoftwareApril 18, 202314
Server component model Client invocation model
• Server component model
›Request-Response and RPC paradigms: use solutions with basic synchronous blocking behavioure.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 SoftwareApril 18, 202315
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 SoftwareApril 18, 202317
WORF - Basic Architecture
WORF: a piece of software plugged in the Websphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareApril 18, 202318
The DB2 XML Extender
Offers …
› Stored Procedures
› Triggers
› User Defined Functions (UDF)
› User Defined Datatypes (UDT)
› Supporting tables
… to extend DB2 functionality!
©2003 BMC SoftwareApril 18, 202319
Two methods (i)
XColumnColumn data = XML documents
DB2 used as XML document repository
Validation of XML docsStoring XML docs
Search through XML docs
©2003 BMC SoftwareApril 18, 202320
Two methods (ii)
XCollectionDB2 used as database (no XML in
DB2)XML is transport language
Validation of XML docsDecompose XML docs into data
Compose XML docs from data
©2003 BMC SoftwareApril 18, 202321
DADs
XML document› Validate
› DTD-id
› Method
› Detailed description of data mapping: DB2 vs. XML
©2003 BMC SoftwareApril 18, 202322
DB2 Web Services
WORF: software plugged in the WebSphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareApril 18, 202323
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 SoftwareApril 18, 202324
WORF configuration files
description of deployed service
servlet mapping
service specificconfig
database specs
engine
©2003 BMC SoftwareApril 18, 202325
DADX Document Access Definition eXtension
›XML document
›a DADX
for each Web Service
›Web Service meths:
DADX operations
›Web Service
documentation
›Query Description
<DADX xmlns="http://schemas…">
<operation name="listPersons">
<query>
<SQL_query>SELECT pfname, plname FROM
db2.persons</SQL_query>
</query>
</operation>
<operation name="InsertPerson">
<call>
<SQL_call>call db2.InPers(:lname, :com) </SQL_call>
<parameter name="lname" type="xsd:string"/>
<parameter name="com" type="xsd:string” kind="out"/>
</call>
</operation>
</DADX>
©2003 BMC SoftwareApril 18, 202326
Possible DADX operations / DB2 manipulations
› select
› insert
› update
› delete
› call
› retrieveXML
› storeXML
SQL based queries XML based queries
©2003 BMC SoftwareApril 18, 202327
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 SoftwareApril 18, 202328
DB2 Web Services
WORF: software plugged in the WebSphere application server used by all DB2 Web Service enterprise applications.
©2003 BMC SoftwareApril 18, 202329
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.
Top Related