# This is REstful SErvices DEscription LAnguage # It began as a hybrid of Tim Bray's SMEX-D and Norm Walsh's NSDL default namespace resedel = "http://www.ccil.org/~cowan/resedel/ns" ## Container for Resedel types and services. start = element resedel {attribute version {"0.2"}, typedef*, service*} ## A type declared with your favorite schema language. This specifies ## how to bind parameters to an RPC-style interface. ## The default schema flavor is RELAX NG. typedef = element type {id, flavor?, content} ## The declaration of a callable service. Services have an id, a URI to ## communicate with, and belong to one of four types corresponding to the ## CRUD database operations. service = element service {id, uri, (create | read | update | delete)} ## A create service (uses POST). create = attribute operation {"create"}, request, full-response ## A read service (uses GET if possible, otherwise POST). ## Specifying "unsafe-read" forces POST. read = attribute operation {"read" | "unsafe-read"}, request, full-response ## An update service (uses PUT). Only faults can be returned. update = attribute operation {"update"}, request, fault-response ## A delete service (uses DELETE). Only faults can be returned. delete = attribute operation {"delete"}, request, fault-response ## A request is written in some language, and has parameters and/or a body. ## If there is no body, use name-value pairs instead. request = element request {soap?, language*, (parameter+ | (parameter*, body))} ## Wrap request-response in SOAP (default false). soap = attribute soap {xsd:boolean} ## The XML language used for writing requests and responses. ## The uri attribute specifies the identity of the language, and may or may not ## be a namespace name. language = element language {uri, schema*} # A schema for validating the language used for requests and responses. # The default schema flavor is RELAX NG. schema = element schema {flavor?, root?, content} ## The root element for schema languages that don't specify one. root = attribute root {xsd:Name} ## A parameter for RPC binding. It's optional iff it has a default value. ## The default type is string. parameter = element parameter {name, typeref?, \default} ## Default value of a parameter. \default = attribute default {string} ## The body of the request. This can contain XSLT-style references to ## the parameters. body = element body {content} ## A response that allows ordinary results and an HTTP location ## as well as faults. An XML language can be specified. full-response = element response {language*, location?, result*, fault*} ## A response that allows only faults. An XML language can be specified. fault-response = element response {language*, fault*} ## A new URI location returned by POST. location = element location {name} ## An ordinary result selected by an XPath. The default type is string. result = element result {name, typeref?, select} ## A fault result specified by either an XPath or an HTTP status code ## The default type is string. fault = element fault {name, typeref?, (select | status)} ## An XPath to select a response or fault. ## When the response is SOAP-wrapped, the XPath is relative to the SOAP body only. select = attribute select {string} ## An HTTP status code. status = attribute status {xsd:int} ## Content, local (embedded) or remote (specified by href) content = any | attribute href {xsd:anyURI} ## Any element any = element * - resedel:* { attribute * {text}* & any & text } ## IDs label types and services. id = attribute xml:id {xsd:ID} ## A URI. uri = attribute uri {xsd:anyURI} ## A schema flavor. flavor = attribute flavor {"xsd" | "relaxng" | "schematron"} ## The name of a parameter, result, or fault. name = attribute name {xsd:NCName} ## A URI referring to a type. This can be just a fragment to refer to a ## locally defined type, or it can refer to an XSD simple type, or to a type ## defined in some other Resedel document. typeref = attribute type {xsd:anyURI}