Tiberius OsBurn wrote a web service. He claims it is not a web service, and perhaps it is not by some people's definition. A few comments... I'm not sure he realizes it but by adding a soap envelope and body around the <authors> element, he would be creating a legal SOAP message (I'd suggest declaring a namespace for authors too, but why quibble?). Why bother with an envelope? It allows for future additions of headers.
In any case, these elements can be added without changing the C# client code one bit.
Now for a few quibbles. The error processing on this service leaves much to be desired. As the output is not well formed XML, the C# code will be a bit upset. If you are going to make this XML anyway, consider making it a SOAP Fault - after all, it only has two required sub elements. Just remember to properly encode any angle brackets that may be in the datastream (stack tracebacks often contain the string <init>). In any case, the HTTP response code should be set to 500. Finally, string concatenation is inefficient and not scalable. If the response can't be written as it is produced, at least consider a StringBuffer.
If these changes are made, the result will be a well behaved document literal SOAP service. Creation of WSDL would be entirely optional. If, however, a WSDL file contains type information, there are tools for both Java and .Net which will produce code which will automatically wrap this information into objects, dramatically simplifying both the client and server code as well as handling all of the messy fault processing.
9:27:59 PM
|
|