33
XForms: A case study Rajiv Shivane & Pavitar Singh

XForms: A case study Rajiv Shivane & Pavitar Singh

Embed Size (px)

Citation preview

Page 1: XForms: A case study Rajiv Shivane & Pavitar Singh

XForms: A case studyRajiv Shivane & Pavitar Singh

Page 2: XForms: A case study Rajiv Shivane & Pavitar Singh

Building a generic Web-Service client

• Problem statement:Need to build HTML forms for invoking operations on any web-service given it’s WSDL– Web services defined using WSDL– Operations are declared in WSDL

• Why XForms– Single Servlet to generate HTML for

invoking any web-service– Generates dynamic forms for Collection data

types– Ease of invoking web-service as submitted

data is in XML format– Built in validation framework

Page 3: XForms: A case study Rajiv Shivane & Pavitar Singh

Implementation overview

WebService

WSDL

Servlet

Parses

XFORMBuilds Chiba

Renders

BrowserUser Enters Data

Invokes Operation Response

Described By

1

2

3

4

5

67

Page 4: XForms: A case study Rajiv Shivane & Pavitar Singh

Sample input-form for an operation

Page 5: XForms: A case study Rajiv Shivane & Pavitar Singh

Form populated with web-service

response

Page 6: XForms: A case study Rajiv Shivane & Pavitar Singh

How Easy it is

Page 7: XForms: A case study Rajiv Shivane & Pavitar Singh

XForms: An introduction

Page 8: XForms: A case study Rajiv Shivane & Pavitar Singh

What is XForms ?

– Next generation web forms from W3C

– W3C Recommendation since October 2003

– Aims at replacing HTML forms– But supports any host language

Page 9: XForms: A case study Rajiv Shivane & Pavitar Singh

XForms Goals

• Make Web form design easier– Less client-side (JavaScript) code– Less server-side code– More functionality!

• Capture data from end-user in XML

Page 10: XForms: A case study Rajiv Shivane & Pavitar Singh

Problems with HTML Forms

• Dependence on Scripting Languages Like Java Script and VB Script to do common tasks– Marking Required Controls– Validations– Calculations– Error Messages– Conditional Layout

• Difficulty of Initializing Form

• Can Represent Only Flat Data (Name Value Pairs)

• Reintrepreting Data Format at every stage of workflow

Page 11: XForms: A case study Rajiv Shivane & Pavitar Singh

Conceptual Structure of XForms

Page 12: XForms: A case study Rajiv Shivane & Pavitar Singh

Sample XForm

Page 13: XForms: A case study Rajiv Shivane & Pavitar Singh

Model Section

• Model Element in Xforms Document

• Contain Child Elements– Instance– Bind– Submit

Page 14: XForms: A case study Rajiv Shivane & Pavitar Singh

Bind

Page 15: XForms: A case study Rajiv Shivane & Pavitar Singh

Model Section

•Encapsulates Data Aspects of a Form•Uses XML Schema to Define

Constraints•Uses Xpath to Define Model Properties•Captures What, How and Where to

submit•Enable Reactive User Interfaces•Encourage declarative authoring

Page 16: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 17: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

• Connects User Interface to the Model

• Uses Xpath to address nodes in the instance

• UI controls collects user input

• Bind to underlying model

• Controls are designed for accessibility

• Abstract Controls encourage Device Independence

Page 18: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 19: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 20: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 21: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 22: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 23: XForms: A case study Rajiv Shivane & Pavitar Singh

UI Controls

Page 24: XForms: A case study Rajiv Shivane & Pavitar Singh

Complex User Interfaces

• Aggregation construct <group>– Group logically related user – Enables Refactoring

Page 25: XForms: A case study Rajiv Shivane & Pavitar Singh

Complex User Interfaces

• Dynamic User Interaction with <switch>– Enables any of logically groups to be

selectively displayed to the User– Use declarative Event Handler <toggle>

Page 26: XForms: A case study Rajiv Shivane & Pavitar Singh

Complex User Interfaces

• Repeating structures with repeat– Very powerful construct

Page 27: XForms: A case study Rajiv Shivane & Pavitar Singh

Event Handlers

Page 28: XForms: A case study Rajiv Shivane & Pavitar Singh

Events

• Bring User Interface to life• Give access to eventing via XML Events• Attach Dynamic Behavior• Obviate common use of scripts via

declarative actions

Page 29: XForms: A case study Rajiv Shivane & Pavitar Singh

Events Categories

• Initialization– Events raised as various Xform components

are initialized

• Interaction– Raised by user interaction

• e.g Request for a Help

• Notification– Raised by Xforms processing model– To trigger different steps in Xforms

processing

• Errors– Raised when specific type of error conditions

are encountered

Page 30: XForms: A case study Rajiv Shivane & Pavitar Singh

Native Xform Support in Web Browsers

• Microsoft doesnt want to support it– Competing with InfoPath

• Mozilla/Firefox Support– In the works but not yet deployed– But still market share under 10%

• But is That a Problem if we want to implement XForm ??????

Page 31: XForms: A case study Rajiv Shivane & Pavitar Singh

The Solution

• Server-side emulation layer A/K/A server-side XForms

• Developer writes XHTML and XForms, as he would with an XForms-aware web browser

• Server-side XForms engine translates this into (X)HTML, CSS, and lightweight JavaScript

• Uses AJAX to achieve asynchronous validation

Page 32: XForms: A case study Rajiv Shivane & Pavitar Singh

Implementations for Server Side XForm

• Orbeon PresentationServer (OPS)• Chiba

→ Both are open source

Page 33: XForms: A case study Rajiv Shivane & Pavitar Singh

Thanks

Q&A