/// <summary>The application starts here.</summary>
    /// <remarks>This method instantiates an <c>XmlRpcServer</c> as an embedded XML-RPC server,
    /// then add this object to the server as an XML-RPC handler, and finally starts the server.</remarks>
    public static void Main() 
      {
	XmlRpcServer server = new XmlRpcServer(PORT);
	server.Add("sample", new SampleServerWithExpose());
	Console.WriteLine("Web Server Running on port {0} ... Press ^C to Stop...", PORT);
	server.Start();
      }
        /// <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();
        }
示例#3
0
 static void Main(string[] args)
 {
     IConfigSource config = new IniConfigSource("../../ppt2os.ini");
     int port = config.Configs["uploader"].GetInt("port");
     XmlRpcServer server = new XmlRpcServer(port);
     server.Add("exposed", new XMLRPC_Service(config));
     Console.WriteLine("Web Server Running on port {0} ... Press ^C to Stop...", port);
     server.Start();
 }
    /// <summary>The application starts here.</summary>
    /// <remarks>This method instantiates an <c>XmlRpcServer</c> as an embedded XML-RPC server,
    /// then add this object to the server as an XML-RPC handler, and finally starts the server.</remarks>
    public static void Main() 
      {
	// Use the console logger above.
	Logger.Delegate = new Logger.LoggerDelegate(WriteEntry);

	XmlRpcServer server = new XmlRpcServer(PORT);
	server.Add("sample", new SampleServer());
	Console.WriteLine("Web Server Running on port {0} ... Press ^C to Stop...", PORT);
	server.Start();
      }
    public XmlRpcSystemObject(XmlRpcServer server)
      {
	_server = server;
	server.Add("system",this);
      }
示例#6
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(GetType().FullName + ".methodHelp", "Return a string description.");
 }
 /// <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.");
 }
 public XmlRpcSystemObject(XmlRpcServer server)
 {
     _server = server;
     server.Add("system", this);
 }
 /// <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);
 }
    /// <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);
      }
        public static void Main(string[] args)
        {           
            // XML-RPC-Stuff
            // Use the console logger above.
            Nwc.XmlRpc.Logger.Delegate = new Nwc.XmlRpc.Logger.LoggerDelegate(WriteEntry);

            XmlRpcSLConnector = new XmlRpcServer(port);
            XmlRpcSLConnector.Add("XmlRpcSLConnector", new CSSLAgentServer());
            Console.WriteLine("Web Server Running on port {0} ... Press ^C to Stop...", port);
            XmlRpcSLConnector.Start();
        }