users@wadl.java.net

Re: Issue with specifying methods

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 20 Feb 2009 09:29:10 -0500

On Feb 19, 2009, at 7:46 PM, Houghton,Andrew wrote:

> I'm trying to write WADL and the current specification doesn't
> support the HTTP OPTIONS, TRACE and CONNECT methods. In addition,
> HTTP allows you to create new methods and there is no way to specify
> them in WADL.

The value is not bounded to the HTTPMethods enumeration, its a union
of that and xs:NMTOKEN:

<xs:simpleType name="Method">
   <xs:union memberTypes="tns:HTTPMethods xs:NMTOKEN"/>
</xs:simpleType>

IOW, you can also use anything that matches xs:NMTOKEN as the value of
method/_at_name so OPTION, TRACE, PATCH etc are all OK.

> Lastly, there appears to be no way to specify as a collective other
> methods not specified by the schema enumeration. Here is a use
> case. I want to create a WADL document where I support GET, but for
> any other method I want to respond with an HTTP 501 Not Implemented
> status:
>
> <application>
> <resources base="http://example.org/foo/">
> <resource>
> <method name="GET">
> <request />
> <response>
> <representation status="200" />
> </response>
> </method>
> <method name="*">
> <request />
> <response>
> <representation status="501" />
> </response>
> </method>
> </resource>
> </resources>
> </application>
>
> I cannot specify a "*" or something else to indicate that when a
> user agent sends me a method, that I have not explicitly listed
> under the resource, I want to tell the user agent that I don't
> implement what they are requesting.
>
Right, you can't do that explicitly but if you don't list a particular
method then you at least implicitly declaring that you don't want to
say anything about that method. A client could always try it of course
but then its a runtime decision about how you respond.

> In addition, I could have created a specialized HTTP FOOBAR method
> for my REST application (no I'm not really planning on doing this)
> however I currently cannot say in WADL:
>
> <method name="FOOBAR">
> <request />
> <response>
> <representation status="200" />
> </response>
> </method>
>
That works fine, see above.

> Sure only my server understands that FOOBAR method, but that is the
> whole reason why I would want to create WADL so my clients know it
> is available and what its responses are.
>
> As a starting point, is there any chance of getting the HTTP
> OPTIONS, TRACE and CONNECT methods put in method enumeration in the
> schema? I think XML schema allows you to have items not
> specifically in the list, which would satisfy the FOOBAR case, but I
> don't remember the magic to do it.
>
Tis done already !

Marc.

---
Marc Hadley <marc.hadley at sun.com>
Sun Microsystems.