Cook Computing

XML-RPC.NET Service Auto-Documentation

October 25, 2002 Written by Charles Cook

I'm currently working on working on the auto-documentation feature of XML-RPC.NET services. This is similar in concept to what you see when you point your browser at a .NET WebService. Reflection is used to extract information from the interface defining the service, in particular from custom attributes defining documentation strings.

I've updated the sample Math Service to demonstrate the current prototype. The page is generated from the following code:


public interface IMath 
{
  [XmlRpcMethod("math.Add", 
    Description="Add two integers and return the result")]
  [return: XmlRpcReturnValue(Description="A plus B.")]
  int Add(
    [XmlRpcParameter(Description="first number")]
    int A, 
    [XmlRpcParameter(Description="second number")]
    int B);
  // ...
}
}

Currently the attributes describing the service have to be placed on the service class:


[XmlRpcService(
  Name="Test Math Service",
  Description="This is a sample XML-RPC service illustrating method calls with simple parameters and return type.")]
public class MathService : XmlRpcService, IMath
{
  // ...
}

Items on the todo list for this include working out how to describe XML-RPC structs which don't have a fixed set of members and the other dynamic features of XML-RPC which don't map well onto static data types; and providing examples of the XML request and response documents for each method (as per .NET WebServices).