Conceptual Modeling Issues in Web Applications
enhanced with Web services
Sara Comai, Politecnico di [email protected]
In collaboration with: Marco Brambilla, Stefano Ceri, Piero Fraternali and Ioana Manolescu
WWW Workshop ESSW2003 May 20, 2003 - Budapest
Introduction:table of contents
The scenario of Web application development Motivations of model-driven Web development extended with Web servicesThe WebML approach and its extension with Web services
Conceptual primitives for Web servicesSome examplesImplementation in WebRatio
Conclusions and future directions
Current Web Applications development
The focus of Web applications is shifting from the mere publication of dynamic content to the integrated publication of
content and services
Services can be used to compose integrated workflows, to support business processes
Web services and model-driven approaches
Technological background: SOAP, UDDI, WSDL, BPEL4WS, WSCI, and so onDevelopment methodologies: new methods and CASE tools are requiredAim of this work:
Conceptual modeling and automatic implementation of Web applications interacting with Web servicesPrimitives for a Web modeling language
Web Modeling Language (WebML)
WebML: a conceptual language for high-level design of data-intensive Web applications
Defined in 1998, widely published: Ceri, Fraternali at al. Designing data-intensive Web applications, Morgan Kauffman, Dec. 2002
Adopted in many universities worldwide
Commercially implemented (www.webratio.com)
Used for developing several applications:www.acer-euro.com, www.aceradvantage.com, www.elet.polimi.it, www.image.co.uk,...
WebML basic concepts
Web application = Structure + Hypertext + Presentation
data model
entities,relationships
navigation + composition model
units, pages, links, site views
presentation
styles
WebML hypertexts
Papers Page
Papers Index
Paper Paper[OID=CurrPaper]
Paper DataCurrPaper:OID
Authors Page
Authors Multidata
Author
All AuthorsIndex of Papers
•Daml-s and WSDL•WebML•Web services
Selected paper
title: Web services abstract: XXX
Go to all authors page
WebML and operations
Entry - Author Page
Entry unit Modify
Author
Error Page
KO
OK Success Page
Insert Your Data
•Fname•Lname
submit
Web services operations
Solicit-responseservice operation
Op. name
Request-responseservice operation
Op. name
Notificationservice operation
Op. name
One-wayservice operation
Op. name
Web service operations corresponding to the WSDL operation types
Further building blocks are needed for integrating Web services in Web applications
Management of input/output messages
Typical use of Web services in Web applications: Perform specific tasks and possibly used the data returned by the invoked Web service to define the content of Web pagesNo need of implementing them directly or of storing the data required for computing them
The integration requires: Managing input/output messages (XML format)Marshalling of the application data into XML and vice versaIn our approach: preserve E-R data model and http-like parameter passing
Example of Web service invocation
Send Mail
Compose ComposeMessage
Send Mail Mail sent
Error page
to, subject,body bodyMsg
KO KO
Chains of Web services
Adapter unit for: Composing the input message of a Web serviceDecomposing the output message of a Web serviceCalling multiple Web services in sequence, adapting their input and output
Enter City
Input City ComposeMessage
CityToZipcity bodyMsg
TransformMsgouputMsg bodyMsg
ZipToTemp DecomposeMessage
outputMsg
Temperature page
Confirm datatemp
Storing the data retrieved from Web services
In many applications data retrieved from Web services need also to be stored in local data repository
Persistent storage: database updatesTemporary storage: e.g., until the user disconnects from the application in main memory
Enter City
Input City ComposeMessage
CityToZip
City page
city bodyMsgDecompose
MessageouputMsg zipCode
Create CIty
City<name := cityName>
<zip := zipCode>
City Multidata
City
city
V V
Lifetime of main memory entities
Lifetime of main memory entities: user sessionIn many cases shorter time is needed, e.g., only between two calls of the same Web serviceDifferent policies to fine tune the behavior of update operations on main memory objects:
FLUSH: each time an entity is updated the new data replace any pre-existing dataPRESERVE: each time an entity is updated the new data is added to any pre-existing data
Managing Web services data
Web services are not developed by the creator of the Web application, therefore:
To build a single entity instance several Web services calls may be neededThe data for composing an input message may be spread across different application entitiesThe data obtained from an output message may be stored into application entities with a different structure
Creation of new instances
Different services may retrieve different pieces of information of the same object or sub-schemaThe same Web service may be used at different times to retrieve different pieces of information for the same object
Policies for managing the cumulative update of data
If the instance is “new” insert the new instanceIf the instance already exists:
No action: keep existing instance
Overwrite: keep only the new instance data
Extend: overwrite with the new instance data
Materialization and dematerialization
Need of creating instances of complex data sub-schemata, involving several related entities, fro the output of a service call
Materialization operation
Need of assembling the input message of a service from instances of complex data sub-schemata
Dematerialization operation
Materialization and dematerialization /2
Intermediate XML format: canonical XML schema
<?xml version="1.0" encoding="UTF-8"?>
<root>
<entity id="Ent1">
<instance>
<attribute id="oid">item1</attribute>
<attribute id="att1"> ... </attribute>
</instance> …
</entity>
<entity id="Ent2">
<instance>
<attribute id="oid">object1</attribute>
<attribute id="att2"> ... </attribute>
</instance>
<instance>
<attribute id="oid">object2</attribute>
<attribute id="att2"> ... </attribute>
</instance>
</entity>
<relationship id="rel_Ent1_Ent2">
<instance>
<source-oid>item1</source-oid>
<target-oid>object2</target-oid>
</instance>
<instance>
<source-oid>item1</source-oid>
<target-oid>object2</target-oid>
</instance>
</relationship>
</root>
MaterializerDematerializerXML-ER XML-ER
Example: Google searchWeb Search
Search the Web ComposeMessage
GoogleSearchkeywords bodyMsg
Transform intoXML-ER
ouputMsg XML-ER
Materialize
V
All Results (max10)
GoogleResultElements
Categories
GoogleDirectoryCategory
V
V
...
Example: Google searchWeb Search
Search the Web ComposeMessage
GoogleSearchkeywords bodyMsg
Transform intoXML-ER
ouputMsg XML-ER
Materialize
V
All Results (max10)
GoogleResultElements
Categories
GoogleDirectoryCategory
V
V
...
Implementation
Web Ratio case tool: integrate environment for the visual specification of Web applications and the automatic generation of code for the J2EE and Microsoft .NET platformReal examples using these concepts:
http://www.webratio.com/webservicedemo
Conclusions and future work
Conclusions: Requirements and primitives to model Web applications interacting with Web services with the aim of providing and automatic implementation of such integration Building blocks:
Supporting the transformation of application data into Web services data and vice versaProviding different storage alternativesProviding specific operations for representing at the conceptual level common processes deriving from the integration of Web services
Future work: Adding semantics to the adapter unit Integrating service-centric applications with workflows
Implementation
WebRatio case tool
Style sheet library
Built-in taglibraries
HTML
Third partyauthoring
tools
XML XSL
Data Mapping
Data Design Site Design Presentation
WebRatio Design Layer
Code Generator
Application Server
WebRatio Runtime Layer
DataSources
Unit library
Customcomponents
Custom unitlibrary
Architecture of WebRatio
Model
SOAP Client(remote peer)HTTP Client
(Browser)
HTTP server + SOAP listener
data tier
Business tierpage services
unit services
operation services
ControllerViewpage templates
Actions
Pageactions
Operationactions
State objects
Webservice
Formbeans
Unitbeans
Example of XSL transformation
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="to"/>
<xsl:param name="subject"/>
<xsl:param name="body"/>
<xsl:template match="/">
<!-- other elements composing the message body -->
<to xsi:type="xsd:string"><xsl:value-of select="$to"/></to>
<subject xsi:type="xsd:string"><xsl:value-of
select="$subject"/></subject>
<body xsi:type="xsd:string"><xsl:value-of select="$body"/></body>
<!-- other elements composing the message body-->
</xsl:template>
</xsl:stylesheet>