SOCKETTechnical blog for SOCKEThttp://www.agbooth.com/SOCKETBlog/www.socketelf.org_8080/roller/socket/feed/entries/atom2008-05-06T18:15:30+01:00Apache Roller (incubating)http://www.agbooth.com/SOCKETBlog/www.socketelf.org_8080/roller/socket/entry/operations_double_trouble.htmlOperations - double troubleBrian Peter Clark2006-04-06T16:09:39+01:002007-09-10T19:20:06+01:00
<p>Building Web Services with Java, Making sense of XML, SOAP, WSDL, and UDDI, (2nd Edition, 2005)by Steve Graham et many als, Sams Publishing.</p>
<p>This is a terrific book - well written with plenty of xml examples.</p>
<p>One little highlighted note in the WSDL chapter goes like this:</p>
<p><font color="blue"><b>Note</b>: When you're designing WSDL portTypes, you should be careful with the names of the portType's operations: They should all be different.</font></p>
<p>Perhaps they should, but <b>need</b> 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.</p>
<p><wsdl:portType name="Test"><br /><br/>
<wsdl:operation name="getTest" parameterOrder="value"><br /><br/>
<wsdl:input message="impl:getTestRequest"name="getTestRequest"/> <br /><br/>
<wsdl:output message="impl:getTestResponse"name="getTestResponse" /> <br /><br/>
</wsdl:operation><br /><br/>
<wsdl:operation name="getTest" parameterOrder="value"><br /><br/>
<wsdl:input message="impl:getTestRequest1" name="getTestRequest1" /> <br /><br/>
<wsdl:output message="impl:getTestResponse1" name="getTestResponse1" /> <br /><br/>
</wsdl:operation><br /><br/>
</wsdl:portType><br /></p>
<p>Sure enough, two operations with the same name. The <b>message</b> 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.</p>
<p>As Atif would say: Job's a good'un.</p>