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); }
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); }