Esempio n. 1
0
        override public String ToString()
        {
            StringWriter  strBuf = new StringWriter();
            XmlTextWriter xml    = new XmlTextWriter(strBuf);

            xml.Formatting  = Formatting.Indented;
            xml.Indentation = 4;
            XmlRpcResponseSerializer.Serialize(xml, this);
            xml.Flush();
            xml.Close();
            return(strBuf.ToString());
        }
Esempio n. 2
0
        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();
        }