SOCKET

Thursday Apr 06, 2006

Operations - double trouble

Building Web Services with Java, Making sense of XML, SOAP, WSDL, and UDDI, (2nd Edition, 2005)by Steve Graham et many als, Sams Publishing.

This is a terrific book - well written with plenty of xml examples.

One little highlighted note in the WSDL chapter goes like this:

Note: When you're designing WSDL portTypes, you should be careful with the names of the portType's operations: They should all be different.

Perhaps they should, but need they be? Atif and I had recently been discussing this matter from the Java to WSDL point of view. The key to the affair is method overloading - two methods with the same name but differentiated by having different signatures. Since portType operations are the equivalent of method names, this would suggest that to accommodate method overloading one might suspect that operations names would not be required to be unique. Out came the WSDL 1.1 specs. Indeed, no stipulations are made about uniqueness of operation names in a WSDL document. Just to make sure, we ran a little test. A Java class with 2 methods with the same name - getTest() - but with different signatures were submitted to the Axis Java2WSDL utility. The relevant part of the resultant WSDL is given below.

<wsdl:portType name="Test">

<wsdl:operation name="getTest" parameterOrder="value">

<wsdl:input message="impl:getTestRequest"name="getTestRequest"/>

<wsdl:output message="impl:getTestResponse"name="getTestResponse" />

</wsdl:operation>

<wsdl:operation name="getTest" parameterOrder="value">

<wsdl:input message="impl:getTestRequest1" name="getTestRequest1" />

<wsdl:output message="impl:getTestResponse1" name="getTestResponse1" />

</wsdl:operation>

</wsdl:portType>

Sure enough, two operations with the same name. The message names, on the other hand, must be unique (as per the specs). These represent the method signatures. You wouldn't want two operations with the same names and the same messages. Again, clever little Axis has differentiated the messages eg getTestRequest and getTestRequest1.

As Atif would say: Job's a good'un.

Calendar

Feeds

Search

Links

Navigation

Referers