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
Implementation overview WebService WSDL Servlet Parses XFORM Builds Chiba Renders Browser User Enters Data InvokesOperation Response Described By
Sample input-form for an operation
Form populated with web-service response
How Easy it is
XForms: An introduction
What is XForms ? –Next generation web forms from W3C –W3C Recommendation since October 2003 –Aims at replacing HTML forms –But supports any host language
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
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
Conceptual Structure of XForms
Sample XForm
Model Section Model Element in Xforms Document Contain Child Elements –Instance –Bind –Submit
Bind
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
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
UI Controls
Complex User Interfaces Aggregation construct –Group logically related user –Enables Refactoring
Complex User Interfaces Dynamic User Interaction with –Enables any of logically groups to be selectively displayed to the User –Use declarative Event Handler
Complex User Interfaces Repeating structures with repeat –Very powerful construct
Event Handlers
Events Bring User Interface to life Give access to eventing via XML Events Attach Dynamic Behavior Obviate common use of scripts via declarative actions
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
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 ??????
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
Implementations for Server Side XForm Orbeon PresentationServer (OPS) Chiba → Both are open source
Thanks Q&A