示例#1
0
        /// <summary>
        /// Dispatches a request to the XML-RPC service.
        /// </summary>
        /// <param name="xmlRpcServiceContext"></param>
        public void Dispatch(IXmlRpcServiceContext xmlRpcServiceContext)
        {
            XmlRpcRequest           xmlRpcRequest           = DeserializeRequest(xmlRpcServiceContext);
            XmlRpcServiceMethodInfo xmlRpcServiceMethodInfo =
                xmlRpcServiceInfo.GetMethod(xmlRpcRequest.MethodName);

            XmlRpcResponse xmlRpcResponse;

            try
            {
                object returnValue = xmlRpcServiceMethodInfo.Invoke(xmlRpcServiceContext.XmlRpcService,
                                                                    xmlRpcRequest.Parameters);
                xmlRpcResponse = new XmlRpcSuccessResponse(returnValue);
            } // try

            catch (Exception e)
            {
                xmlRpcResponse = new XmlRpcFaultResponse(new XmlRpcFault(0, e.ToString()));
            } // catch

            xmlRpcSerializer.SerializeResponse(xmlRpcResponse, xmlRpcServiceContext.OutputStream);
        }
示例#2
0
 private XmlRpcRequest DeserializeRequest(IXmlRpcServiceContext xmlRpcServiceContext)
 {
     return(xmlRpcSerializer.DeserializeRequest(xmlRpcServiceContext.InputStream, this));
 }