/// <summary>Handle an HTTP request containing an XML-RPC request.</summary>
        /// <remarks>This method deserializes the XML-RPC request, invokes the
        /// described method, serializes the response (or fault) and sends the XML-RPC response
        /// back as a valid HTTP page.
        /// </remarks>
        /// <param name="httpReq"><c>SimpleHttpRequest</c> containing the request.</param>
        public void Respond(SimpleHttpRequest httpReq)
        {
            XmlRpcRequest  xmlRpcReq  = (XmlRpcRequest)_deserializer.Deserialize(httpReq.Input);
            XmlRpcResponse xmlRpcResp = new XmlRpcResponse();

            try
            {
                xmlRpcResp.Value = _server.Invoke(xmlRpcReq);
            }
            catch (XmlRpcException e)
            {
                xmlRpcResp.SetFault(e.FaultCode, e.FaultString);
            }
            catch (Exception e2)
            {
                xmlRpcResp.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR,
                                    XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
            }

            if (Logger.Delegate != null)
            {
                Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information);
            }

            XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output);
            httpReq.Output.Flush();
            XmlTextWriter xml = new XmlTextWriter(httpReq.Output);

            _serializer.Serialize(xml, xmlRpcResp);
            xml.Flush();
            httpReq.Output.Flush();
        }
Beispiel #2
0
 /// <summary>Constructor.</summary>
 /// <param name="server"><c>XmlRpcServer</c> server to be the system object for.</param>
 public XmlRpcSystemObject(XmlRpcServer server)
 {
     this._server = server;
     server.Add("system", this);
     _methodHelp.Add(string.Format("{0}.methodHelp", this.GetType().FullName), "Return a string description.");
 }
 /// <summary>Basic constructor.</summary>
 /// <param name="server">XmlRpcServer that this XmlRpcResponder services.</param>
 /// <param name="client">TcpClient with the connection.</param>
 public XmlRpcResponder(XmlRpcServer server, TcpClient client)
 {
     _server  = server;
     _client  = client;
     _httpReq = new SimpleHttpRequest(_client);
 }
Beispiel #4
0
 /// <summary>Basic constructor.</summary>
 /// <param name="server">XmlRpcServer that this XmlRpcResponder services.</param>
 /// <param name="client">TcpClient with the connection.</param>
 public XmlRpcResponder(XmlRpcServer server, TcpClient client)
 {
     this._server = server;
     this._client = client;
     this.HttpReq = new SimpleHttpRequest(this._client);
 }
Beispiel #5
0
 public RpcServer(int port)
 {
     this.port = port;
     server = new XmlRpcServer(port);
 }
 /// <summary>Constructor.</summary>
 /// <param name="server"><c>XmlRpcServer</c> server to be the system object for.</param>
 public XmlRpcSystemObject(XmlRpcServer server)
 {
     _server = server;
     server.Add("system", this);
     _methodHelp.Add(this.GetType().FullName + ".methodHelp", "Return a string description.");
 }
Beispiel #7
0
 /// <summary>Basic constructor.</summary>
 /// <param name="server">XmlRpcServer that this XmlRpcResponder services.</param>
 /// <param name="client">TcpClient with the connection.</param>
 public XmlRpcResponder(XmlRpcServer server, TcpClient client)
 {
     _server = server;
     _client = client;
     _httpReq = new SimpleHttpRequest(_client);
 }
Beispiel #8
0
 /// <summary>Constructor.</summary>
 /// <param name="server"><c>XmlRpcServer</c> server to be the system object for.</param>
 public XmlRpcSystemObject(XmlRpcServer server)
 {
     _server = server;
     server.Add("system", this);
     _methodHelp.Add(this.GetType().FullName + ".methodHelp", "Return a string description.");
 }