- Existing Web Services
- Exposing Systems as Web Services
- Clustering Methods Usefully
- About This Article
Clustering Methods Usefully
Of course, Web services shouldn't follow the same conventions as Perl object methods simply because the interfaces can be connected automatically. Many object methods are defined for use by programmers with intimate knowledge of the interfaces they define. Simply exposing these methods directly as Web services won't make for service descriptions that are easy to understand.
Instead, Web services should be designed to be as human-readable and understandable as possible. Methods should be given descriptive titles that reflect their intended functions, and all parameters should be given names that make sense within the service description. For instance, an object method implemented on the server as getHeads with the parameters string, int, and bool probably won't illuminate the purpose of the function very well. However, a SOAP method definition such as the following would make it clearer:
<getNewsHeadlinesRequest> <siteName xsi:type="xsd:string" /> <numberOfHeadlines xsi:type="xsd:int" /> <provideSynopsis xsi:type="xsd:boolean" /> </getNewsHeadlinesRequest>
In addition, Web service methods should be clustered into SOAP objects that reflect a single overall purpose, however those methods are implemented on the server. In practice, this means that functions usually separated in Perl codesuch as database access, session handlers, and search algorithmsshouldn't be presented as individual SOAP objects. Instead, methods should be clustered into objects based on their purpose within the Web service, such as retrieving shipping information or placing a customer service request.