Main
ibm.com/redbooks
The XML Files:
Front cover
Development of XML/XSL Applications Using WebSphere Studio Version 5
Page
Page
Page
Contents
Page
Page
Page
Page
Page
Notices
IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A.
x
Trademarks
Preface
The team that wrote this redbook
Page
Become a published author
Comments welcome
Page
Page
Page
Page
1.1 XML concepts
1.2 Background
1.3 XML business benefits
1.3.1 Information sharing
1.3.2 XML within an organization
1.3.3 XML in new innovations
Voice XML
Scalable Vector Graphics
1.4 Technical benefits of XML
Acceptability of use for data transfer
Uniformity and confor mity
Simplicity and openness
Separation of data and display
Extensibility
1.5 XML history
Generalized Markup Language
generic coding
The SGML Handbook
1.6 XML1.0 and 1.1
1.7 XSLT and Web applications
Presentation Logic
Web Ti er
1.8 Web services and XML
Simple Object Access Protocol
Universal Description Discovery and Integration
Web Services Description Language (WSDL) is a language that is used to
1.9 XML, W3C, and IBM
publish wi th WSDL find thru WSDL first bind, then invoke
SOAP
Recommendations
Candidate recommendations
Working drafts
Page
Page
2.1 XML Processor (parser)
Tree-based parsing
Event-based parsing
2.2 DTD and XML Schema
Page
2.3 Schema and style using CSS, XSLT, and XSL
Cascading Style Sheet (CSS)
2.4 XML namespaces
Page
2.5 Link and jump using XLink, XPointer, and XML Base
Page
Example 2-4 An extended link
XML Base
XML Pointer
XPointer paths and steps
Page
XPointer string functions
2.6 XPath
2.7 XML digital
Page
Examples of XML encryption
Example of a XML digital signature
Transforms
After this user signs and encrypts this document, it would look like Example 2-13.
Example 2-13 The final XML document after encryption
Other security specifications
2.8 XML query language
Path expressions
Element constructors
FLWR(FOR, LET, WHERE and RETURN clauses) expression
Conditional expressions (IF THEN ELSE)
Quantifiers
Filtering
Querying relational data
Grouping in XQuery
Joins
2.9 XSLT compilers (XSLTC)
XSLT processor
Using XSLTC:The Apache XML Project
2.10 Java Architecture for XML Binding (JAXB)
2.11 Cocoon
Generators and reader: pipeline inputs
Transformers and actions: processing steps
Serializer: pipeline outputs
Matchers and selectors: conditional processing
Sitemap
Page
Page
Page
Page
3.1 XML applications
3.2 Xalan
3.3 SAX2
Figure 3-3 SAX application components
To understand how an event-based API can work, consider the sample document in Example 3-1.
Example 3-1 Sample XML document
Example 3-2 Sample event breakdown
SAX2 classes and interfaces
XML namespace supp ort
3.4 DOM level2
DOM hierarchy
Page
XML namespace supp ort
3.5 JAXP
Using JAXP
Application Code
JAXP
SAX Parser Implementati on
DOM API Implementation
XSLT support packages in JAXP
Stylesheet compilation
Page
70
4.1 WebSphere Studio product family
Figure 4-1 WebSphere Studio family
App lication Developer - IE
IBM We bSphere Studio Family
Site Developer Advanced
WebSphere Studio Site Developer Advanced
WebSphere Studio Application Developer
WebSphere Studio Application Developer Integration Edition
WebSphere Enterprise Developer
4.2 Tools
4.2.1 Web development tools
4.2.2 Relational database tools
4.2.3 XML tools
4.2.4 Java development tools
4.2.5 Web services development tools
4.2.6 EJB development tools
4.2.7 Team collaboration
4.2.8 Debugging tools
4.2.9 Performance profiling tools
4.2.10 Server tools for testing and deployment
4.2.11 Plug-in development tools
Page
5.1 XML perspective
5.2 XML perspective editors
5.2.1 XML editor
Creating an XML file from scratch
Editing an XML file
Validating the XML file
5.2.2 DTD editor
Creating a DTD from scratch
Using the Outline view to add DTD components
Validating DTD
5.2.3 XSD editor
Creating a schema from scratch
Using the Outline view to add schema components
Making changes and referential integrity
Namespace
Validating schema
5.2.4 XSL editor
Creating an XSL file from scratch
Editing an XSL file
Validating the XSL file
5.3 Namespace support
Page
5.4 XPath support
Page
Page
Page
5.5 XSL debugger
Page
5.6 Web services support
Web Service DADX group configuration wizard
Web service wizard
Page
Page
Page
6.1 The SQL to XML wizards
schema definition as,
Show table column as option
XML and XSL files
Page
Page
HTML file
Page
Page
XML Schema file
Page
Page
Page
Page
DTD file
Example 6-5 DTD generated by the Show table as Elements option
Page
The Query template file
Page
6.2 The XML to SQL wizard
Page
Page
Page
Figure 6-12 Generate XML Schema
The XML Schema generated for the SCHEDULE table is shown below:
Example 6-10 XML Generated through the DDL to XML Schema
Page
Example 6-11 XML Schema for a single table using a Select
6.4 DB2 XML Extender
DB2 e-business Guide
XMLCLOBFromFile
XML Extender
128
Figure 6-13 XML Extender overview
Table 6-2 UDTs created
Administrative support tables, UDTs, and UDFs
XML Extender Overview
Administrative Support Tables User Defined Tables
XML Column XML Collection
XML Documents
Application
Table 6-3 UDFs created
Table 6-4 Stored Procedures created
DTD Repository
redbook.DTD
x
Document Access Definitions (DAD)
dtd
redbook_title_sidetab
XML Column method
as is
When to use XML Column method
6.4.1 XML Collection
XML Column Method Overview
elements/attributes
XML Column Method
Document insert, update, delete, search & retrieve (UDFs and Stored Procedures
XML Documents
XML Collection Method Overview
XML Collection Method
XML Documents
Application
DB2 XML Extender
Mapping schemes for XML collections
SQL mapping
data model
138
Table 6-6 EMP_ACT TABLE in SAMPLE database
Example 6-15 Example DAD file specification with SQL_mapping scheme
Column name Data type
140
RDB_node mapping
RDB_node for the top element_node:
XML Extender admini stration tools
142
XML MQSeries enablement
as-is
Page
Page
Page
7.1 DTD <> XSD
7.2 XML <> DTD/XSD
7.2.1 Create an XML file from a DTD file
7.2.2 Create an XML file from an XSD file
7.2.3 Create DTD/XSD files from XML
150
7.3 Generate a HTML from an XSD
7.4 JavaBeans from DTD/XSD
7.5 Generate XML/XSL from JavaBeans
154
Page
7.6 Generate XML/XSL from HTML
7.6.1 Preparing the HTML file for generation
Adding annotation tags
158
Example 7-5 cus-template.xhtml
Page
160
Page
Page
approaches
164
8.1 XML in Application development
8.2 Web services
Interoperability:
Ubiquity
Low barrier to Entry
Industry Support
8.3 Passenger List application
8.3.1 Solution Outline
168
8.3.2 XML in this application
Client Web Tier
Servlet
Data Server
Web Services
8.3.3 Technical implementation overview
Figure 8-2 Development and running of the Passenger List application
AIRLINE proj ect
TRAVEL project
Servlet
170
Discussion:
172
8.4 Enterprise JavaBeans
Page
174
8.5 The Customer Registration application
8.5.1 XML in this application
8.5.2 Technical overview
176
Page
178
9.1 Passenger List application
9.1.1 Creating the Web tier
Client Web Tier
Servlet
Data Server
9.1.2 Create the Airline simple project
9.1.3 Create the Travel Web project
9.1.4 Design the XML Schema
Page
Page
Figure 9-6 XML Schema Example 9-1 PassengerList.xsd
184
9.1.5 Generate XML file
9.1.6 Design an output page
HTML and mapping ap proach
Page
186
Generate an XSL file
,
XSLT
Mapping XML to HTML
Source Target
188
Create an XSL from scratch
Generating XSL from XH TML
9.1.7 Testing the XSL
9.1.8 Developing the servlet
190
Using JAXP
9.1.9 Test the passenger list application
9.1.10 Compiling XSL
192
9.2 Creating a Web service
Web Service
9.2.1 Create the database tier
194
9.2.2 Generate DTD file
passengerList.xsd>Generate>DTD
9.2.3 Loading DTD into XML Extender
Note:
9.2.4 Creating DAD file using RDB to XML mapping
Page
,
9.2.5 Create the Web Service from DADX file
DAD Extension
200
Web services and DB2 XML Extender
The DADX Group
The group.properti es File
Generating the DADX
DADX operations
204
<retrieveXML>
<storeXML>
Deploying the Web serv ice
Page
9.2.6 Test the Web Service
Invoke
208
9.2.7 Modify passenger list application to use the Web Service
Mapping DTDIDs to XSD namespaces and locations
Modifying the XSL file
passengerList.xsl
210
Creating HTML input form
l processor using jaxp
xs
For an example of an input form, see Figure 9-22.
212
Using Java proxy
JAXP DOM I/O
Conclusion
Page
Enterprise applications
216
10.1 XML based Enterprise application architecture
Client Web Tier
AppServer
10.2 Solution outline for customer registration sample
Customer registration
218
Retrieving cu stomer information
10.3 Developing the customer registration sample
220
10.3.1 Creating the Web tier
Generates
Preparing to create the Web tier
Project configuration
CustomerInfo CustomerInfoClient CustomerInfoEJB CustomerInfoWeb
Creating the Web tier
Page
Page
Page
Page
Page
Page
228
Java source files:
Java Bean
JAXP
XML Data
produceDOM Document
org.w3c.dom.Document
230
Page
produceDOMDocument
OUT
XSL Files:
234
Example 10-8 Sample structure for the input XML data to the stylesheet
The structure of the target HTML format for the customer XML data is shown in Example 10-9.
Example 10-9 Format of the target HTML representation for the customer data
236
HTML Files:
Schema Files:
Validating the Web tier
238
10.3.2 Building the entity EJB and the database schema
EJB mapping approaches review
Preparing to create the entity EJB
Project configuration
Creating the entity EJB
Page
Creating the database mapping and tables
Page
Page
Page
Access beans
246
Creating an access bean for the entity bean
Creating a JDBC data source
Page
Binding the EJB to a JDBC data source
250
10.3.3 Integrating the entity EJB with the Web tier
Modifying Custom erXML
Page
252
Modifying CustomerXSLServlet
10.3.4 Retrieval function
10.4 Application deployment and testing
254
10.4.1 Testing the registration application
CustomerXMLServlet, and select the option Run on Server fro m the menu.
Page
Page
Enterprise Application
258
11.1 SQL to/from XML libraries
Client Web Tier
11.2 Solution outline for customer registration sample
11.2.1 Customer registration
Tip:
260
11.2.2 Retrieving customer information
Tip:
262
11.3 Developing the customer registration sample
11.3.1 Adding the libraries to the project
XMLTo SQL SQLTo XML
11.3.2 XML Document format
11.3.3 XMLToSQL architecture
JdbcDriver LoginId Passwor d JdbcServer Schema Action
XML Document
Tip:
264
11.3.4 Modifying CustomerXSLServlet
execute
Initializing the XMLToSQL class
Creating an XML Document
Modifying the produceDOMDocument method
266
We need to change to:
We created a new produceDOMDocumentforTools method as follows.
Example 11-2 ProduceDOMDocumentforTools
Executing the XMLToSQL class
Modifying the doPost me thod
Adding the error case
11.3.5 Retrieving a customer
Initializing the SQLToXML class
Executing the SQLToXML class
Modifying the doPost me thod
queryBtn
Modifying the showPag e method
274
Modifying the doGet method
Regarding the above modification, doGet must be changed to set document.
Example 11-11 showPage method
Modifying the XSL file
Example 11-12 Customer.XSL membership template
Example 11-13 Result XSL
276
11.3.6 Using datasource with SQLToXML and XMLToSQL class
278
Application
DB
Figure 11-10 SQLToXMLds and XMLToSQLds
Class definition
Getting the datasource
We add to methods to set datasource. We used two approaches to get the datasource.
Tip: You need to add naming.jar from runtime library under
runtime/base_v5/lib.
Constructors
Example 11-15 setDatasourceMethods
Execute methods
11.3.7 Conclusion
DB
Page
application
12.1 Manual deployment
12.1.1 Exporting your project from Application Developer
12.1.2 Installing the EAR file on WebSphere AEs
12.1.3 Starting the WebSphere AEs Admin Console
12.1.4 Installing the EAR
12.1.5 Testing the application
12.2 Publishing to a remote server (AEs)
12.2.1 Creating a remote server instance
Page
Page
Page
Page
Page
Page
12.2.2 Publishing to remote server
12.2.3 Testing the application
Page
Page
Page
Page
Things to do before installation
Installing Application Developer
Page
Selecting your workspace
Verifying the installation
Page
Page
Things to do before installation
Hardware and software prerequisites
or
Create groups and users
Check that IP ports are unused
Install WebSphere Application Server
Page
Verifying the installation
Page
C
Locating the Web material
Using the Web material
File name Description
System requirements for downloading the Web material
How to use the Web material
Abbreviations and acronyms
314
Related publications
IBM Redbooks
Java and XSLT, OReilly,
DB2 UDB e-business Guide,
Web Services Wizardry with WebSphere Studio Application Developer,
How to get IBM Redbooks
IBM Redbooks collections
Index
A
C
D
E
H
I
J
M
N
T
U
V
W
X
Page
Page
Page
Page
INTERNATIONAL TECHNICAL SUPPORT ORGANIZATION
The XML Files:
Back cover
Development of XML/XSL Applications Using WebSphere Studio Version 5