- From: Klotz, Leigh <Leigh.Klotz@xerox.com>
- Date: Wed, 25 Jul 2007 10:57:06 -0700
- To: <www-forms@w3.org>
I found the following article on WADL a good introduction: http://searchwebservices.techtarget.com/tip/0,289483,sid26_gci1265367,00 .html The sample WADL example looked a lot like an XForms model. It contains a data definition, links to schemas, model item properties such as required, data type definitions on nodes, and a submission method. It was so similar, in fact, that I thought I'd re-write it as XForms, hosted in XHTML. There are a couple of things that are missing from the XForms version, such as links between the sections defining operations, but I've replaced those with a submit button (not strictly the same). Here it is, mechanically translated. A sufficiently clever programmer could probably write an XSLT to do this. The original remains in the link above. Leigh. <?xml version="1.0"?> <html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:yn="urn:yahoo:yn" xmlns:ya="urn:yahoo:api"> <head> <title>WADL Example</title> <!-- the schema attribute does what the grammars/include elements do in WADL --> <model xmlns="http://www.w3.org/2002/xforms" schema="NewsSearchResponse.xsd NewsSearchError.xsd"> <!-- this instance contains the implied data in the method/request element of WADL --> <instance id="searchRequest"> <data xmlns=""> <appid /> <query /> <type /> <results /> <start /> <sort /> <language /> </data> </instance> <!-- this instance is the place where the data in the method/response goes --> <instance id="searchResponse"> <data xmlns="" /> </instance> <!-- this bind contains the type and property declarations from method/request of WADL --> <bind nodeset="instance('searchData')"> <bind nodeset="appid" type="xsd:string" required="true()"/> <bind nodeset="query" type="xsd:string" required="true()"/> <bind nodeset="type" type="xsd:string"/> <bind nodeset="results" type="xsd:int"/> <bind nodeset="start" type="xsd:int"/> <bind nodeset="sort" type="xsd:string"/> <bind nodeset="language" type="xsd:string"/> </bind> <!-- This submission replaces the method attributes from WADL --> <submission id="search" method="get" action="http://api.search.yahoo.com/NewsSearchService/V1/newSearch" ref="instance('searchRequest')" replace="instance" instance="searchResponse" /> </model> </head> <body> <group xmlns="http://www.w3.org/2002/xforms"> <!-- this group is generated from the method/request/query_variables with label==name --> <group ref="instance('searchRequest')"> <input ref="appid"> <label>appid</label> </input> <input ref="query"> <label>query</label> </input> <input ref="results"> <label>results</label> </input> <input ref="start"> <label>start</label> </input> <input ref="sort"> <label>sort</label> </input> <input ref="language"> <label>language</label> </input> <submit submission="search"> <label>search</label> </submit> </group> <!-- The WADL has no information about the response other than element name, so we do the same here. Any UI put here will display only in case of good result though --> <group ref="instance('searchResponse')/yn:ResultSet"> </group> <!-- The WADL has no information about the error other than element name, so we do the same here. Any UI put here will display only in case of error result though --> <group ref="instance('searchResponse')/ya:Error"> </group> </group> </body> </html>
Received on Wednesday, 25 July 2007 17:57:32 UTC