Cook Computing

Dave Winer uses an article

January 31, 2002 Written by Charles Cook

Dave Winer uses an article on Web Services interop to knock .NET Web Services:

Read this article on Web Services interop. It's an eye-opener because they include sample code for a web service in .NET. Look at all the overhead. Did they really design an environment for web services? If so what are all those magic incantations about?

The code in question is:


<%@ WebService Language="C#" Class="Hello" %>

using System.Web.Services;

[WebService(Namespace="urn:Hello")]
public class Hello {
  [ WebMethod ]
  public string sayHello(string name) {
    return "Hello " + name;
  }
}

Taking it line by line from the top, the initial line specifies the .NET language that is being used to create the Web Service (e.g. C#, VB.NET or JScript), it also specifies the class name that is being exposed as a Service - this may be defined in the .asmx file or in an assembly in the \bin directory of the application. The using statement provides access to classes in the specified namespace without having to use fully qualified names. The WebService attribute is actually optional but is being used here to specifiy a namespace that will be used in the SOAP request. The WebMethod attribute specifies that the method is being exposed as a method of the Web Service, after all you might want to define other methods in the class which you don't want exposed.

Pretty straightfoward really and no more complex than the Perl or Java samples (both of which are split into two examples and so are arguably more complex). Anyway, the amount of application code in a non-trivial Web Service would dwarf the plumbing code described above.