/// <summary>Classes Main method.</summary>
    /// <remarks>This method opens an XML file as a <c>StreamReader</c> and then asks
    /// <c>XmlRpcRequestDeserializer.Parse</c> to deserialize it into an <c>XmlRpcRequest</c>. The 
    /// resultant request is now displayed.
    /// </remarks>
    public static void Main(String[] args) 
      {
	Logger.Delegate = new Logger.LoggerDelegate(WriteEntry);
	XmlRpcRequestDeserializer deserializer = new XmlRpcRequestDeserializer();

	Console.WriteLine("Attempting to deserialize " + args[0]);
	StreamReader input = new StreamReader(args[0]);
	XmlRpcRequest req = (XmlRpcRequest)deserializer.Deserialize(input);
	Console.WriteLine(req);
      }
        public void HttpPost(SimpleHttpRequest req)
        {
            XmlRpcRequest rpc = XmlRpcRequestDeserializer.Parse(req.Input);

            XmlRpcResponse resp   = new XmlRpcResponse();
            Object         target = _handlers[rpc.MethodNameObject];

            if (target == null)
            {
                resp.SetFault(-1, "Object " + rpc.MethodNameObject + " not registered.");
            }
            else
            {
                try
                {
                    resp.Value = rpc.Invoke(target);
                }
                catch (XmlRpcException e)
                {
                    resp.SetFault(e.Code, e.Message);
                }
                catch (Exception e2)
                {
                    resp.SetFault(-1, e2.Message);
                }
            }

            Logger.WriteEntry(resp.ToString(), EventLogEntryType.Information);

            SendHeader(req.Protocol, "text/xml", 0, " 200 OK", req.Output);
            req.Output.Flush();
            XmlTextWriter xml = new XmlTextWriter(req.Output);

            XmlRpcResponseSerializer.Serialize(xml, resp);
            xml.Flush();
            req.Output.Flush();
        }