Lists Home |
Date Index |
Francis Norton wrote:
> I know I have a bit of a blind-spot here. What is the canonical example
> of a "resource" v. a "representation"? Say I wanted to look up trains
> from London to North Berwick - is the URL of the query a representation
> of the timetable resource?
The timetable is a resource. A URL is never a representation: the
representation is the stuff that gets sent across the wire: the XML or
XHTML or whatever. It is what you GET and PUT.
Here's the radical bit: ideally there would be *no* query in this
system. Let's say the XML was organized like this:
Then you have the document:
Now you get into this service through the "routes" document above,
follow the hyperlink to the "ondonToNorthBerwick" document and find the
information you need. You've never done a query and you've never had to
send complex XML.
When you do it this way:
1. the client's access to the data is not mediated by any API or
messaging interface. This is very much in the XML spirit of "give me the
data and I (the client) will figure out what to do with it.
2. you cannot generate a "bad query" by trying to get from London,
Ontario to North Berwick, Scotland (nor North Berwick Maine to London,
England!). If there is no link for that route then you can't get there.
3. the client can discover routes, rather than merely generate them and
test whether they exist or not. For instance it could say: "hmmm. I
notice a route from London to Glasgow and Glasgow to North Berwick.
Maybe this is also interesting to my user."
4. the standardization of the "routes" format and the "times" format
can actually be fairly disconnected. For instance we might use the same
"times" format for airlines and trains but the "routes" format might be
different. Or else we could use XML extensibility features to share both
but have different details on both.
5. the server can easily serve these as either dynamic OR static
documents. The performance advantages to the latter should be obvious.
>... That seems simple enough, but what is the
> representation that I send - one representation of the train route from
> London to North Berwick, or a combination of representations for the
> locations of London and North Berwick?
It's like asking how you model objects in an OO systems. I guess I would
tend towards breaking things apart rather than combining them but that's
just a very rough rule of thumb. But note that the question is really
how you break out the *resources*. Representations just represent
resources on the wire.
> I like the way that W3C specs come with "this version" and "latest
> version" links at the top, and I find it frustrasting that I can't refer
> to resources in Visual SourceSafe in the same way, so I think I'm making
Yep, using hyperlinks like that is very resty. Visual SourceSafe
probably has an "API" that allows you to access older versions through
code. That's a very "SOAP-y" way to look at it.
> >XForms *does* have GET support.
> Can XForms understand GET or POST Web Services described in WSDL? I
> imagine WSDL is a bit short on form layout details, but does XForms have
> helpful deaults?
XForms does not know anything about WSDL. After all the former is a W3C
specification and the latter has only just begun its standardization
process. And anyhow, they are kind of parallel specifications. WSDL is
used to map the interface to a web site into an interface suitable for
programmers. XForms is used to map it into an interface suitable for
humans. There wouldn't be that much in common between them other than
the XML Schema.