Re: Code generation or forms?

On 6/6/05, Mark Baker <distobj@acm.org> wrote:
> 
> I wonder if some use cases for the description language aren't in order?

How about starting with something  minimal? I've probably got errors
in the syntax, but just for a general idea -

Service 1P:
A GET at http://example.com/divide with the query part of the URI
containing two values, x and y, will produce a response with the body
containing x/y.
e.g.

-Request- 
GET /divide?x=6&y=2 HTTP/1.1
example.com
Accept: text/plain
---------

-Response-
HTTP/1.1 200 OK
Content-Type: text/plain

2
----------

Service 2P: 
A POST at http://example.com/add containing a value in the body will
add that value to a variable maintained server-side. The sum is
available through a GET.

-RequestA- 
GET /add HTTP/1.1
example.com
Accept: text/plain
---------

-ResponseA-
HTTP/1.1 200 OK
Content-Type: text/plain

110
----------

-RequestB- 
POST /add HTTP/1.1
example.com
Accept: text/plain

2
---------

-ResponseB-
HTTP/1.1 200 OK
Content-Type: text/plain

112
----------

Ok, now XML versions of those:

Service 1PX:

-Request- 
GET /xml/divide?x=6&y=2 HTTP/1.1
example.com
Accept: text/plain
---------

-Response-
HTTP/1.1 200 OK
Content-Type: text/plain

<result>2</result>
----------

Service 1XX:
(angle brackets unescaped for clarity)

-Request- 
GET /xml/divide?query=<values><x>6</x><y>2</y></values> HTTP/1.1
example.com
Accept: text/plain
---------

-Response-
HTTP/1.1 200 OK
Content-Type: text/plain

<result>2</result>
----------

Service 2XX:

-RequestB- 
POST add HTTP/1.1
example.com
Accept: text/plain

<value>2</value>
---------

-ResponseB-
HTTP/1.1 200 OK
Content-Type: text/plain

<result>112</result>
----------
 


-- 

http://dannyayers.com

Received on Monday, 6 June 2005 06:01:24 UTC