Exemple #1
0
        public Object Execute(IXmlRpcRequest request)
        {
            if (_mapping.AuthenticationHandler != null && !_mapping.AuthenticationHandler.IsAuthorized(request))
            {
                throw new XmlRpcException("Not authorized");
            }

            if (request.Target == null && _targetProvider != null)
            {
                request.Target = _targetProvider.GetTarget(request);
            }
            IXmlRpcHandler handler = (IXmlRpcHandler)request.Target;

            return(handler.Execute(request));
        }
Exemple #2
0
        private MethodCall DeserializeRequest(ITransportHeaders requestHeaders, Stream requestStream, IXmlRpcStreamRequestConfig config)
        {
            String requestUri = GetRequestUri(requestHeaders);
            Type   svcType    = GetServerTypeForUri(requestUri);

            if (!_mapping.Has(svcType))
            {
                _mapping.Register(svcType);
            }
            IXmlRpcRequest request = GetRequest(config, requestStream);
            IXmlRpcHandler handler = GetHandler(request);

            Header[]   headers = GetChannelHeaders(requestUri, request, handler, svcType);
            MethodCall call    = new MethodCall(headers);

            call.ResolveMethod();
            return(call);
        }
 private static Header[] GetChannelHeaders(String requestUri, IXmlRpcRequest request, IXmlRpcHandler handler, Type type)
 {
     List<Header> headers = new List<Header>();
     headers.Add(new Header("__Uri", requestUri));
     headers.Add(new Header("__TypeName", type.AssemblyQualifiedName));
     headers.Add(new Header("__MethodName", handler.GetMethod(request).Name));
     headers.Add(new Header("__Args", request.Parameters));
     return headers.ToArray();
 }
        /// <summary>
        /// Executes a XML-RPC request.
        /// </summary>
        /// <param name="request">the <see cref="LX.EasyWeb.XmlRpc.IXmlRpcRequest"/> to execute</param>
        /// <returns>a result object</returns>
        /// <exception cref="LX.EasyWeb.XmlRpc.XmlRpcException">no matched handler is found, or an exception occurs when handling the request</exception>
        public Object Execute(IXmlRpcRequest request)
        {
            IXmlRpcHandler handler = GetHandler(request);

            return(handler.Execute(request));
        }
Exemple #5
0
        private static Header[] GetChannelHeaders(String requestUri, IXmlRpcRequest request, IXmlRpcHandler handler, Type type)
        {
            List <Header> headers = new List <Header>();

            headers.Add(new Header("__Uri", requestUri));
            headers.Add(new Header("__TypeName", type.AssemblyQualifiedName));
            headers.Add(new Header("__MethodName", handler.GetMethod(request).Name));
            headers.Add(new Header("__Args", request.Parameters));
            return(headers.ToArray());
        }
Exemple #6
0
        public String GetMethodHelp(String name)
        {
            IXmlRpcHandler handler = GetHandler(name);

            return(handler is IXmlRpcMetaDataHandler ? ((IXmlRpcMetaDataHandler)handler).MethodHelp : null);
        }
Exemple #7
0
        public String[][] GetMethodSignature(String name)
        {
            IXmlRpcHandler handler = GetHandler(name);

            return(handler is IXmlRpcMetaDataHandler ? ((IXmlRpcMetaDataHandler)handler).Signatures : null);
        }