W3C home > Mailing lists > Public > www-ws-desc@w3.org > March 2003

RE: Thoughts on urlReplacement, REST, and R085

From: Mark Baker <mbaker@idokorro.com>
Date: Thu, 27 Mar 2003 22:35:24 -0500
Message-ID: <0503561D34C63045B07F04E5B3B2BFDC152346@FRED.planetfred.internal>
To: "Arthur Ryman" <ryman@ca.ibm.com>
Cc: <www-ws-desc@w3.org>

Hi Arthur,
Ergh, sorry about that last one, I'm not used to Outlook; who knew
ctrl-enter meant send? 8-/  Anyhow, I can't seem to respond inline in
this mode.  Feh.  Please excuse the format of this message.
I've heard about the requirement to make HTTP methods specifiable on a
per-operation basis, but I believe that to be a non-problem.  The
problem, and the reason why WSDL remains unusable in a "RESTful" manner,
is because it currently fails to recognize that HTTP methods *are* WSDL
operations.  i.e. "GET" is an operation that is invoked over a network,
which requires feedback from application objects on the other end.  More
on this, peripherally, below.
Re creating a new part, there is more than one way to do that.  Both the
solutions you suggest - POST to a list, PUT to a new resource - are
possible solutions that make sense in different situations, though the
former is by far the most common idiom with the least number of
"gotchas", at least in my experience.
Your comment about "getPartDetail" being documentation is bang on.
Later, you ask for CRUD-like semantics to describe operations, yet
REST's "uniform interface" provides a necessarily more general framework
for not just describing operations, but for implementing them.  I
suppose you could declare "getPartDetail" to be an *abstract* "GET"
(i.e. independant of HTTP) and then have that map to FTP RETR in an FTP
binding; there may be some value to that, such as in auto-generation of
proxy code.  Note though, that an SMTP binding would be impossible if
that were the case, since it has no equivalent for "retrieve"; that's a
GoodThing. 8-).
BTW, *please* feel free to trim followups.  For some (argh!!) reason, I
can't remove them from mine.
 -----Original Message-----
From: Arthur Ryman [mailto:ryman@ca.ibm.com]
Sent: Thursday, March 27, 2003 6:08 PM
To: Mark Baker
Cc: www-ws-desc@w3.org; www-ws-desc-request@w3.org
Subject: RE: Thoughts on urlReplacement, REST, and R085


Thx for the feedback. 

In a separate piece of work Philippe and I have revised the HTTP binding
for WSDL 1.2. In WDSL 1.1 the HTTPbinding  used either GET or POST for
all the operations, which is of course wrong wrt REST. The revision
allows you to specify the HTTP verb on a per operation basis. Philippe
will post this soon. Pls comment on that when it appears. 

SOAP 1.2 only specifies GET and POST, not the other HTTP verbs, allow it
leaves this possibility open. I think there is value is using the other
verbs but I personally could use some guidance on their semantics. For
example, to create a new Part at Part Depot, what should I do? Should I
POST a Part document to the part list URI, or should I PUT a Part
document to a new part URI? Also, technically, a purist might say that
my Update Quantity example was a hack since I should really PUT and new
Part document (or subset of one) to the Part URI instead of POSTing.
When I DELETE, am I deleting from the Part List URI or do I send a
DELETE to the Part URI? I think we could make progress on the other
verbs if there was a shared understanding of their intended semantics.
At present, we have at least established that GET should be side-effect
free to enable caching. Perhaps we could adopt the semantics for the
verbs defined by WebDAV? 

I understand the point about uniform interface, and I think we are not
really inconsistent here. In my example below, I call the operation
getPartDetail, but that is really just documentation for the reader.
That verb does NOT appear on the URI. Consider queries we might make on
the part list. If I do an unqualified GET, I receive the entire state of
the list. But maybe if the list if huge, the server will rightly refuse
to send it, and instead sends me a failure response. What I should do is
a GET that filters the result by some criteria. For example, I could
define a getByIdRange operation in WSDL like this: 

<message name="getByIdRangeInput"> 
        <part name="lowerId" type="xsd:string"/> 
        <part name="upperId" type="xsd:string"/> 

<portType name="partDetailInterface"> 
        <operation name="getByIdRange"> 
                <input message="tns:getByIdRangeInput"/> 
                <output message="tns:getPartListOutput"/> 

I invoke the operation like: 


So we are still using the GET verb, but we are documenting the semantics
of the query parameters in the WSDL and giving the operation a
meaningful name. If this was Smalltalk, the operation would be named
something like GET:lowerId:upperId, i.e. the formal parameter names get
concatenated together to form a method name. GET is like an overloaded
method in C++, Java, etc. The unfiltered and filtered operations have
the following signatures: 

PartList GET( ); 
PartList GET(String lowerId, String upperId); 

In WSDL we decided to avoid overloading, so we need to assign unique
names to the operations. For HTTP, the names don't necessarily appear in
the message. However, the names are still useful when it comes to code
generation, e.g. the above operations get mapped to: 

PartList getPartList( ); 
PartList getByIdRange(String lowerId, String upperId); 

So circling back to your suggestion, I think it would be useful to add
information to the operation to indicated its semantics (e.g.
create/delete/update/retrieve, aka CRUD), but this is independent of
HTTP since the operation definition is abstract. The semantic hint could
be used to select the proper HTTP verb in the HTTP binding and the
SOAP/HTTP binding. For example, delete/create/update might collapse unto

Arthur Ryman 

	"Mark Baker" <mbaker@idokorro.com> 
Sent by: www-ws-desc-request@w3.org 

03/27/2003 02:23 PM 

        To:        "Arthur Ryman" <ryman@ca.ibm.com>,
        Subject:        RE: Thoughts on urlReplacement, REST, and R085 


Right on, Arthur.

I just have one minor disagreement with it though, where you say that
you believe that satisfying R085 will suffice to address this
deficiency.  While I believe that satisfying R085 is necessary, I don't
believe it is sufficient, as I also believe that issue 64 must be
addressed, perhaps with a solution that I proposed in [1] and [2].  The
reason I believe this, is that the semantics of a WSDL operation (e.g.
"getPartDetail" in the example you provided) is no longer part of the
interface published by the server when GET is used (i.e. clients aren't
required to know what it means).  So just satisfying R085 would leave
WSDL in a state where sometimes operation names are part of the
interface, and sometimes not.  My proposal to expose GET, PUT, POST,
etc.. as WSDL operation names would address this.

Does that make sense?


BTW, apologies in advance for future tardy followups, as I'm only able
to get email sporadically while I endure the painful process of
switching ISPs. 8-{

[1] http://lists.w3.org/Archives/Public/www-ws-desc/2003Jan/0103
[2] http://lists.w3.org/Archives/Public/www-ws-desc/2003Jan/0111


-----Original Message-----
From: Arthur Ryman [mailto:ryman@ca.ibm.com]
Sent: Thursday, March 27, 2003 10:50 AM
To: www-ws-desc@w3.org
Subject: Thoughts on urlReplacement, REST, and R085

I took an action item on 2003-02-13 to look at urlReplacement and to
determine if it was adequate for REST style Web services. My conclusion
is that urlReplacement is syntactically expressive enough to describe
the type of URIs employed, but its use raises architectural concerns.
Consider the example described in "Building Web Services the REST Way"
by  Roger L. Costello [1]. 

In this example, there is a Web application at the fictious company
"Parts Depot, Inc." that allows you to obtain a list of parts, get
detailed information about a specific part, and submit a purchase order

To obtain the part list, send an HTTP GET to: 


You receive the following XML document: 

<?xml version="1.0"?> 
<p:Parts xmlns:p="http://www.parts-depot.com" 
     <Part id="00345"
     <Part id="00346"
     <Part id="00347"
     <Part id="00348"

To obtain the detail on part 00345, send an HTTP GET: 


You receive the following XML document: 

<?xml version="1.0"?> 
<p:Part xmlns:p="http://www.parts-depot.com"   
     <Description>This part is used within the frap
     <UnitCost currency="USD">0.10</UnitCost> 

In this example we have 5 URI's: 1 for the part list and 4 for the
parts. How many Web services do we have? In [1] the view is that we have
two, one for the part list and one for all the parts. 

Consider the part detail service. If we only have the GET operation
described here, then WSDL 1.1 urlReplacement is adequate to describe the
service., e.g. 

<message name="partDetailInput"> 
       <part name="id" type="xsd:string"/> 

<message name=partDetailOutput"> 
       <part name="return" element="tns:PartDetail"/> 

<portType name="partDetailInterface"> 
       <operation name="getPartDetail"> 
               <input message="tns:partDetailInput"/> 
               <output message="tns:partDetailOutput"/> 

<binding name="partDetailHttp" type="tns:partDetailInterface"> 
       <http:binding verb="GET"/> 
       <operation name="getPartDetail"> 
               <http:operation location="(id)"/> 
                       <mime:mimeXml part="return"/> 

<service name="partDetailService"> 
       <port name="partDetailPort" binding="tns:partDetailHttp> 

However, this approach breaks down if we add another operation, say one
to update the part detail, using POST. Although we can't combine GET and
POST in the same binding in WSDL 1.1, this is an accepted requirement
for WSDL 1.2. Let's assume we have an updateQuantity operation which has
the following input message: 

<message name="updateQuantityInput"> 
       <part name=id" type=xsd:string"/> 
       <part name="quantity" type="xsd:int"/> 

We have a problem now because we need to bind the id to the url using
urlReplacement and the quantity to the message body using mimeXml. But
urlReplacement and mimeXml are mutually exclusive in WSDL 1.1. We could
simply revise the binding in WSDL 1.2 to allow this, but then we run
into another conceptual problem. 

Consider the output of the part list. It contains URIs for the parts,
e.g. http://www.part-depot.com/parts/00345. This URI is something we can
send messages to and get responses back from so it is natural to regard
it as the endpoint of a Web service. But in our example we are not
treating each part as a Web service. We are treating the set of all the
parts as a single Web service, i.e. the part detail Web service. 

I suggest that it is natural to regard each part as a Web service
endpoint. The part id is then encoded in the address of the Web service
and is not treated as an input parameter to a Web service operation. We
therefore have one Web service for the part list and one Web service for
each part. Now it is of course non-sensical to have a WSDL <service>
element for each part since the set of parts is more likely to be 40,000
than 4. In practice, the part list would be dynamic with parts being
added and removed. Therefore there must be another way to publish the
URIs for the parts. The answer is in improving the description of the
part list service to include the information that identifies the URIs
are being Web service endpoints. This is requirement R085. A client of
the part detail Web service discovers the part URIs via the part list
Web service, and not via <service> elements in WSDL documents. 

In conclusion, the current urlReplacement mechanism is inadequate in
practice and is inconsistent with REST since it obscures the role of
URIs. IMHO, the correct resolution of this problem lies in satisfying

[1] http://www.xfront.com/REST-Web-Services.html

Arthur Ryman
Received on Thursday, 27 March 2003 22:35:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:58:23 GMT