ObserverTutorial/Contract

Version 1 (modified by jean-gui, 4 years ago)

--

The Contract

The contract is an XML file used to describe the observer's capabilites and how Unicorn can call it. It uses the  WADL format which is a machine process-able description of such HTTP-based Web applications.

This contracts gives several information to Unicorn:

  • possible input methods of the observer (input by URI, by text or by file)
  • possible parameters for each input method
  • types of these parameters

sdf

<?xml version="1.0"  encoding="utf-8"?>

<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://research.sun.com/wadl"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
    

                        <doc title="responseType">default</doc>
                
                        <doc xml:lang="en" title="name">W3C HTML Validator</doc>
                        <doc xml:lang="fr" title="name">W3C Validateur HTML</doc>
                        
                        <doc title="mimetype">text/html</doc>
                        <doc title="mimetype">application/xhtml+xml</doc>
                        <doc title="mimetype">image/svg+xml</doc>
                        <doc title="mimetype">application/mathml+xml</doc>
                        <doc title="mimetype">application/smil+xml</doc>
                        
                        <doc title="paramOutput">output</doc>
                

    <resources base="http://localhost/">
      <resource uri="calculator.php">
        <method name="GET" id="CalculatorGET">

                                <doc title="inputMethod">URI</doc>
                                <doc title="inputParamName">url</doc>
          <request>
            <query_variable name="uri" />
            <query_variable name="x2" type="xs:boolean"/>
          </request>
        </method>
      </resource>
    </resources>
</application>