WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your...
Transcript of WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your...
![Page 1: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/1.jpg)
IBM Software Group
®
WORF:Developing DB2 UDB based Web Services on aWebsphere Application Server
![Page 2: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/2.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 3: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/3.jpg)
IBM Software Group
®
DB2 UDB v8.1
![Page 4: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/4.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 5: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/5.jpg)
IBM Software Group | DB2 Information Management Software
Storing data… is evolved to:
Checking data(Constraints)
Maintaining data(Triggers, Generated Columns)
Gathering data(Federated Databases)
Tailoring data(Updateable Views)
Generating data(Identity Columns, GeneratedSequence)
DEMO
DEMO
DEMO
DEMO
![Page 6: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/6.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 7: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/7.jpg)
IBM Software Group | DB2 Information Management Software
Integration with Business Logic
StoredProcedures
![Page 8: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/8.jpg)
IBM Software Group | DB2 Information Management Software
Advantages ofStored Procedures
Faster execution
Reduced network traffic
Modular programming
Increased security
![Page 9: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/9.jpg)
IBM Software Group | DB2 Information Management Software
Writing Stored Procedures
Languages: Java, C,…
Generation with GUI:
Stored Procedure Builder (v7)
Development Center (v8)
SQL/PL
DEMO
DEMO
DB2 UDB v8 fully supports thedynamic CALL statement
![Page 10: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/10.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 11: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/11.jpg)
IBM Software Group | DB2 Information Management Software
What is an XML-document?Adds metadata to your data
Hierarchical structure
Consists of Elements andAttributes
<Course id=”1”><Title>DB2 UDB for OS/390</Title><Description>This Course reveals the secrets of the leading RDBMS ...</Description><Prereq_list>
<Prereq>Know the concepts of a relational Database</Prereq><Prereq>Know some basic SQL</Prereq><Prereq>Have some experience on an OS/390 platform</Prereq>
</Prereq_list></Course>
![Page 12: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/12.jpg)
IBM Software Group | DB2 Information Management Software
Structure of XML-document is defined: Schema / DTD
<!ELEMENT Course (Title,Description,Prereq_list)><!ATTLIST Course id CDATA #REQUIRED><!ELEMENT Title (#PCDATA)><!ELEMENT Description (#PCDATA)><!ELEMENT Prereq_list (Prereq+)><!ELEMENT Prereq (#PCDATA)>
<Course id=”1”><Title>DB2 UDB for OS/390</Title><Description>This Course reveals the secrets of the leading RDBMS ...</Description><Prereq_list>
<Prereq>Know the concepts of a relational Database</Prereq><Prereq>Know some basic SQL</Prereq><Prereq>Have some experience on an OS/390 platform</Prereq>
</Prereq_list></Course>
DTD:
Document Type Definition
![Page 13: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/13.jpg)
IBM Software Group | DB2 Information Management Software
The DB2 XML Extender offers you...
Stored Procedures
Triggers
User Defined Functions (UDF)
User Defined Datatypes (UDT)
Supporting tables
…to extend the DB2 functionality!
![Page 14: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/14.jpg)
IBM Software Group | DB2 Information Management Software
The DB2 XML Extender:
![Page 15: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/15.jpg)
IBM Software Group | DB2 Information Management Software
Preparing your Database for use by XML Extender
Using the DB2 Command LineProcessor
Use the administration interfacedxxadm …
Enable your databasedxxadm enable_db <database>
Using the XML ExtenderGUI / administration wizard.
Start the administration wizardjava com.ibm.dxx.admin.Admin
jre com.ibm.dxx.admin.Admin
Connect to your database
Enable the database
DEMO DEMO
![Page 16: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/16.jpg)
IBM Software Group | DB2 Information Management Software
Two methods to work with XML in DB2
XColumn XCollection
![Page 17: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/17.jpg)
IBM Software Group | DB2 Information Management Software
Validation of XML documents
Storing XML documents
Fast Search through XMLdocuments
XColumn
Column data = XML documentsor
DB2 is used as XML document repository
![Page 18: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/18.jpg)
IBM Software Group | DB2 Information Management Software
XColumn
![Page 19: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/19.jpg)
IBM Software Group | DB2 Information Management Software
Validation of XML documents
Decomposing XML documentsto DB2 data
Composing XML documentsfrom DB2 data
XCollection
DB2 is used as database (no XML in DB2)or
XML is used as “transport language”to / from DB2
![Page 20: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/20.jpg)
IBM Software Group | DB2 Information Management Software
XCollection
![Page 21: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/21.jpg)
IBM Software Group | DB2 Information Management Software
Communication with XML Extender throughDAD’s (Document Access Definition)
![Page 22: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/22.jpg)
IBM Software Group | DB2 Information Management Software
DAD = XML Extender option description
XML document
Validate: YES / NO
DTD-id
Method: XColumn / XCollection
Detailed description of data mapping: DB2 vs. XML
<DAD><dtdid>e:\xmldocs\companyRegistration.dtd<dtdid><validation>YES</validation><XCollection>...</XCollection></DAD>
![Page 23: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/23.jpg)
IBM Software Group | DB2 Information Management Software
(De)composing XML document to relational data:RDB-node mapping
XCollectionTable specifications
Join conditions
Attribute - column mapping
Element - column mapping
![Page 24: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/24.jpg)
IBM Software Group | DB2 Information Management Software
<Xcollection><prolog>?xml version="1.0" encoding="UTF-8"?</prolog><doctype>!DOCTYPE companyRegistration SYSTEM "E:\XMLdocs\companyRegistration.dtd”</doctype><root_node>
<element_node name="companyRegistration"><RDB_node>
<table name="companies" key="id"/><table name="persons" key="sofi"/><table name="loans"/><condition>companies.company_id = loans.loan_company_idAND persons.person_sofi = loans.loan_person_sofi</condition>
</RDB_node>
XCollectionTable specifications
Join conditions
RDB-node mapping
![Page 25: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/25.jpg)
IBM Software Group | DB2 Information Management Software
<attribute_node name="id"><RDB_node>
<table name="companies"/><column name="company_id" type="smallint"/>
</RDB_node></attribute_node>
XCollectionAttribute - column mapping
RDB-node mapping
Element - column mapping
<element_node name="name"><text_node>
<RDB_node><table name="companies"/><column name="company_name" type="char(10)"/>
</RDB_node></text_node>
</element_node>
DEMO
![Page 26: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/26.jpg)
IBM Software Group | DB2 Information Management Software
Composing XML document from relational data:SQL mapping
XCollectionSQL statement
Attribute - column mapping
Element - column mapping
![Page 27: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/27.jpg)
IBM Software Group | DB2 Information Management Software
<Xcollection><SQL_stmt>select person_sofi, person_lastname, person_firstname, loan_no,
loan_nrmonths * loan_monthlypayment as atpfrom db2.persons, db2.loanswhere person_paybehaviour = 'B' and loan_person_sofi = person_sofi and loan_company_id = 12order by person_sofi, loan_no
</SQL_stmt><prolog>?xml version="1.0" encoding="UTF-8"?</prolog><doctype>!DOCTYPE list_loans SYSTEM "E:\UTD-seminar\XMLdocs\list-loans.dtd"</doctype>
XCollectionSQL statement
SQL mapping
![Page 28: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/28.jpg)
IBM Software Group | DB2 Information Management Software
XCollection
SQL mappingColumn - attribute mapping
<element_node name="loan_list">
<element_node name="loan" multi_occurrence="YES">
<attribute_node name="no">
<column name="loan_no" type="smallint"/>
</attribute_node>
Column - element mapping
<element_node name="amount_to_pay">
<text_node>
<column name="atp" type="integer"/>
</text_node>
</element_node>
DEMO
![Page 29: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/29.jpg)
IBM Software Group
®
DB2 Web Services
![Page 30: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/30.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 31: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/31.jpg)
IBM Software Group | DB2 Information Management Software
Basic Architecture
WORF: a piece ofsoftware plugged inthe Websphereapplication serverused by all DB2Web Serviceenterpriseapplications.
![Page 32: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/32.jpg)
IBM Software Group | DB2 Information Management Software
Web Service Object Runtime Framework (WORF)provides the features:
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
![Page 33: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/33.jpg)
IBM Software Group | DB2 Information Management Software
Necessary files for a WORF web servicedeployment:
web.xml
Servlet-mapping: mapping between URL and physical directory
dds.xml (deployment descriptor)
Description of each deployed web service
group.properties
For each group of web services: database specifications
• database-name
• userid
• password
• ...
<db2 web service name>.dadx
Together with a “worf-servlets.jar” fileEmbedded in a predefined directory structure
![Page 34: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/34.jpg)
IBM Software Group | DB2 Information Management Software
Predefined directory structure
Save this structure into a.war file
Install the .war as EnterpriseApllication in the WAS
DEMO
![Page 35: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/35.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 36: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/36.jpg)
IBM Software Group | DB2 Information Management Software
The DADX document:Document Access Definition eXtension
XML document
a DADX for each Web
Service
Web Service methods =
DADX operations
Web Service and method
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.InsertPerson(:lastname,
:comment) </SQL_call>
<parameter name="lastname" type="xsd:string"/>
<parameter name="comment" type="xsd:string"
kind="out"/>
</call>
</operation>
</DADX>
![Page 37: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/37.jpg)
IBM Software Group | DB2 Information Management Software
SOAP request processing by WORF
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
Note: One SQL statement for each Web Service invocation
![Page 38: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/38.jpg)
IBM Software Group | DB2 Information Management Software
SOAP request processing by WORF
![Page 39: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/39.jpg)
IBM Software Group | DB2 Information Management Software
Possible DADX operations / DB2 manipulations
SELECT
INSERT
UPDATE
DELETE
CALL
retrieveXML
storeXML
SQL based queries XML based queries
![Page 40: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/40.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 41: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/41.jpg)
IBM Software Group | DB2 Information Management Software
INSERT / UPDATE / DELETE operations
<update> - operation
Input parameters indicated
with colon
Parameter description
Return value: 0 or 1
<DADX xmlns="http://schemas.ibm.com/db2/dxx/dadx"xmlns:xsd="http://www.w3.org/2001/XMLSchema"><operation name="newPerson">
<update><SQL_update>insert into persons(person_sofi, person_lastname, person_firstname)values (:sofi, :lastname, :firstname)</SQL_update><parameter name="sofi" type="xsd:string"/><parameter name="lastname" type="xsd:string"/><parameter name="firstname" type="xsd:string"/>
</update></operation>
</DADX> DEMO
SQL based queries
![Page 42: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/42.jpg)
IBM Software Group | DB2 Information Management Software
SELECT operations
<query> - operation
Input parameters indicated
with colon
Parameter description
Return: result table in
default XML-tagging
(column = element name)
<operation name="listPersonTotals"><wsdl:documentation>A DADX-query. Lists the personswith more than "nrloans" loans in company with id "compid"</wsdl:documentation><query>
<SQL_query>Select person_sofi, person_lastname,person_firstname, count(*) as number_of_loans,sum(loan_nrmonths * loan_monthlypayment) asamount_to_pay
from persons, loanswhere loan_person_sofi = person_sofi and loan_company_id = :compid
group by person_sofi, person_lastname, person_firstname
having count(*) >= :nrloans</SQL_query><parameter name="compid" type="xsd:short"/><parameter name="nrloans" type="xsd:long"/>
</query></operation>
DEMO
SQL based queries
![Page 43: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/43.jpg)
IBM Software Group | DB2 Information Management Software
CALL operations
<call> - operation
Input / Output parameters indicated with colon
Parameter description
Return:
Output parameters
Result set(s) in default XML-tagging
Result set description
SQL based queries
![Page 44: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/44.jpg)
IBM Software Group | DB2 Information Management Software
CALL operation without result set
<operation name="updatePaybehaviour"><wsdl:documentation>A DADX-call.</wsdl:documentation><call>
<SQL_call>call javaUpdatePaybehaviour (:newPaybehaviour, :firstname, :lastname)
</SQL_call><parameter name="newPaybehaviour" type="xsd:string"/><parameter name="firstname" type="xsd:string"/><parameter name="lastname" type="xsd:string"/>
</call></operation>
DEMO
SQL based queries
![Page 45: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/45.jpg)
IBM Software Group | DB2 Information Management Software
CALL operation with result set
<DADX xmlns="http://schemas.ibm.com/db2/dxx/dadx" xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<result_set_metadata name="listPersonInfo" rowName="personInfoRow">
<column name="PERSON_SOFI" type="CHAR" as="SofiNr" nullable="false"/>
<column name="PERSON_LASTNAME" type="CHAR" as="LastName" nullable="true"/>
<column name="PERSON_FIRSTNAME" type="CHAR" as="FirstName" nullable="true"/>
</result_set_metadata>
<operation name="monthlyUpdate">
<call>
<SQL_call>call SqlplMonthlyUpdate (:compid, :nrUpdates, :comment) </SQL_call>
<parameter name="compid" type="xsd:short"/>
<parameter name="nrUpdates" type="xsd:long" kind="out"/>
<parameter name="comment" type="xsd:string" kind="out"/>
<result_set name="badPayers" metadata="listPersonInfo"/>
</call>
</operation>
</DADX>
DEMO
SQL based queries
![Page 46: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/46.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 47: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/47.jpg)
IBM Software Group | DB2 Information Management Software
Store XML operations
<storeXML> - operation
DAD needed for XMLdecomposition
Name Space Table needed
<name-space-table-name>.nst
indicate name ingroup.properties file
<operation name="newCompanyRegistration">
<wsdl:documentation>storeXML</wsdl:documentation>
<storeXML>
<DAD_ref>companyRegistration.dad</DAD_ref>
</storeXML>
</operation>
DEMO
XML based queries
![Page 48: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/48.jpg)
IBM Software Group | DB2 Information Management Software
Retrieve XML operations
<retrieveXML>
DAD needed for XML composition
SQL override
XML override
Input parameters indicated with colon
Return: XML document in DAD-defined tagging
XML based queries
![Page 49: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/49.jpg)
IBM Software Group | DB2 Information Management Software
XML based queriesRetrieve XML operations<operation name="listPersonLoans">
<wsdl:documentation>retrieveXML.</wsdl:documentation><retrieveXML>
<DAD_ref>badPayers.dad</DAD_ref><SQL_override>select person_sofi, person_lastname, person_firstname, loan_no,
loan_nrmonths * loan_monthlypayment as atpfrom db2.persons, db2.loanswhere person_lastname = :lastnameand person_firstname = :firstnameand loan_person_sofi = person_sofiand loan_company_id = :compidorder by person_sofi, loan_no
</SQL_override><parameter name="lastname" type="xsd:string"/><parameter name="firstname" type="xsd:string"/><parameter name="compid" type="xsd:short"/>
</retrieveXML></operation>
DEMO
![Page 50: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/50.jpg)
IBM Software Group
®
Calling DB2 Web Services
![Page 51: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/51.jpg)
IBM Software Group | DB2 Information Management Software
Agenda
DB2 UDB v8.1:• Storing Data
• Integration with Business Logic
• Integration with XML
DB2 Web Services:• SOAP service communication with DB2: WORF
• Web Service specification: DADX document
• SQL based queries
• XML based queries
Calling DB2 Web Services:• Changes to Client Programs
![Page 52: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/52.jpg)
IBM Software Group | DB2 Information Management Software
Question:
“If we compare a DB2 webservice with other web services.Do we have to make anychanges to Client Programs?”
![Page 53: WORF: Developing DB2 UDB based Web Services on a Websphere … · 2020. 6. 8. · Preparing your Database for use by XML Extender Using the DB2 Command Line Processor Use the administration](https://reader034.fdocuments.in/reader034/viewer/2022052000/601305429927fa4c600d1580/html5/thumbnails/53.jpg)
IBM Software Group | DB2 Information Management Software
Answer:
“No!”