Esempio n. 1
0
        internal XmlRpcResponse CallConfluenceMethodWithoutLogin(string methodName, params object[] parameters)
        {
            XmlRpcResponse response = null;
            XmlRpcRequest  request  = new XmlRpcRequest();

            //Set the method for the request.
            request.MethodName = methodName;

            //Add the Parameters to the request
            request.Params.Clear();
            foreach (object parameter in parameters)
            {
                request.Params.Add(parameter);
            }

            //Attempt to send the request
            try
            {
                response = request.Send2(_url, request.ToString());

                //Check for general errors only. Specific errors will be handled
                //by the calling method.
                if (response.Value != null && response.IsFault)
                {
                    //TODO : sort out error reporting
                }
            }
            catch (WebException ex)
            {
                //TODO : sort out error reporting
            }


            return(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Execute DokuWiki command
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public T Get <T>(XmlRpcRequest type, params string[] val)
        {
            string methodName = type.ToString();

            return(this.Get <T>(
                       this._RpcXmlRequestToString <Data.RpcXmlRequestString>(
                           this._CreateRequestFromString(type, methodName, val),
                           methodName
                           )
#if DEBUG_XMLResponse
                       , methodName
#endif
                       ));
        }
Esempio n. 3
0
        /// <summary>
        /// Execute DokuWiki command
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type"></param>
        /// <param name="val"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public T Get <T>(XmlRpcRequest type, string val, int n)
        {
            string methodName = type.ToString();

            return(this.Get <T>(
                       this._RpcXmlRequestToString <Data.RpcXmlRequestComposite>(
                           this._CreateRequestFromComposite(type, methodName, val, n),
                           methodName
                           )
#if DEBUG_XMLResponse
                       , methodName
#endif
                       ));
        }
Esempio n. 4
0
        internal XmlRpcResponse SendLoginRequest()
        {
            //We cannot use CallConfluenceMethod, since it calls this method.

            XmlRpcResponse response = null;

            //Build the request manually
            XmlRpcRequest request = new XmlRpcRequest();

            //Set the method for the request.
            request.MethodName = "confluence1.login";

            //Add the Parameters to the request
            request.Params.Clear();
            request.Params.Add(_username);
            request.Params.Add(_password);

            //Send the request
            try
            {
                //String login(String username, String password) - login a user. Returns a String authentication token to be passed as authentication to all other remote calls. It's not bulletproof auth, but it will do for now. Must be called before any other method in a 'remote conversation'. From 1.3 onwards, you can supply an empty string as the token to be treated as being the anonymous user.
                response = request.Send2(_url, request.ToString());

                if (!response.IsFault && response.Value != null)
                {
                    //Login succeeded.
                }
                else
                {
                    //TODO : sort out error reporting
                }
            }
            catch (WebException ex)
            {
                //TODO : sort out error reporting
            }

            return(response);
        }