On WSDL Operations Again

With some delay, I've read JimW's post on WSDL operations. I guess I belong to the other camp and my usual example on why operations matter follows.

Expanding on Jim's example of

MessageX op1(MessageA)
MessageX op2(MessageB)

I suggest we consider the situation where two different operations take the same messages and actually return the same messages (in format):

int plus(TwoInts)
int minus(TwoInts)

This is currently allowed in WSDL2. Does that mean, though, that if I send the service two ints, it returns an int and I don't know which operation was executed?

If we want the answer to be yes (as I believe Jim's opinion to be) we must clearly disallow such WSDLs, and explain clearly why we do this and how to model a service that does adding and subtracting with numbers. My only problem with this direction is that many people will need education to grasp it.

Posted at 1805 on Fri, Sep 3, 2004 in category Ideas | TrackBack | Comments feed

Hey Jacek,
The problem here is that your messages are super-weak. If you had messages like "DifferenceMessage" or "TotalMessage" which are more descriptive, this doesn't happen.
So: if you treat WSDL like a traditional IDL it will break as you point out. If you use it right, it enables loose-coupling.

Posted by: Jim Webber at September 4, 2004 10:16 AM

Ah-ha! Putting the operation name in the message, right? 8-)

My point is, there should be synergy between WSDL operations and pieces of functionality of the service. I consider this good modeling practice that should be encouraged by WSDL.

The client then wants to initiate a given piece of functionality, so if two operations are to share the same message format, there must be some distinguisher in the data (our outside the data) that says which of the two operations will be executed. This distinguisher should be described in WSDL as well. On simple types this would mean the two message formats differing by one element having one of two disjunct restrictions of the simple type. On complex types it would be more complex. Alternately, some other distinguisher could be used outside the data, like the infamous SOAP Action. In any case, WSDL should tell the client which it is, so that the client can make sure it initiates the expected piece of functionality.

Posted by: Jacek at September 4, 2004 10:25 PM

Hey Jacek,
Not putting the operation name in the messge explicity - just making the messages descriptive, which is what a description (as opposed to prescription) language should support.
You know I don't agree that WSDL operations are anything but virtual - all they do is collectively define message exchanges that a service supports. To my mind this is perfect synergy between contract and service implementation - you give me an X, and I might give you a Y or a Z in return depending on your X.
If you make your messages ambgiuous then you have probably got your design wrong, and then you need to fall back on stuff like soap action or other explicit dispatch hackery.

Posted by: Jim Webber at September 6, 2004 3:00 AM