Пример #1
0
        public void SynchronousFaultException()
        {
            var proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));

            try
            {
                var ret1 = proxy.GetStateName(100);
                Assert.Fail("exception not thrown on sync call");
            }
            catch (XmlRpcFaultException fex)
            {
                Assert.AreEqual(1, fex.FaultCode);
                Assert.AreEqual("Invalid state number", fex.FaultString);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var proxy = XmlRpcProxyGen.Create <IIsEven>();

            var x = proxy.is_even(4);

            Console.WriteLine(x);

            var y = proxy.add(4, 5);

            Console.WriteLine(y);


            Console.ReadLine();
        }
Пример #3
0
        private static Proxy CreateProxy(string url, int timeout)
        {
            var xmlrpcProxy = XmlRpcProxyGen.Create <Proxy>();

            xmlrpcProxy.Url            = url;
            xmlrpcProxy.NonStandard    = XmlRpcNonStandard.All;
            xmlrpcProxy.Timeout        = timeout;
            xmlrpcProxy.UseIndentation = false;
            xmlrpcProxy.UserAgent      = UserAgent;
            xmlrpcProxy.KeepAlive      = true;

            xmlrpcProxy.Proxy = Proxy;
            // reverted because of CA-137829/CA-137959: _proxy.ConnectionGroupName = Guid.NewGuid().ToString(); // this will force the Session onto a different set of TCP streams (see CA-108676)
            return(xmlrpcProxy);
        }
Пример #4
0
 private Session(int timeout, IXenConnection connection, string url)
 {
     Connection            = connection;
     _proxy                = XmlRpcProxyGen.Create <Proxy>();
     _proxy.Url            = url;
     _proxy.NonStandard    = XmlRpcNonStandard.All;
     _proxy.Timeout        = timeout;
     _proxy.UseIndentation = false;
     _proxy.UserAgent      = UserAgent;
     _proxy.KeepAlive      = true;
     _proxy.RequestEvent  += LogRequest;
     _proxy.ResponseEvent += LogResponse;
     _proxy.Proxy          = Proxy;
     // reverted because of CA-137829/CA-137959: _proxy.ConnectionGroupName = Guid.NewGuid().ToString(); // this will force the Session onto a different set of TCP streams (see CA-108676)
 }
Пример #5
0
        //- @Ping -//
        public static void Ping(String name, Uri uri)
        {
            ITechnoratiPing proxy = XmlRpcProxyGen.Create <ITechnoratiPing>();
            XmlRpcStruct    call  = new XmlRpcStruct();

            call.Add("name", name);
            call.Add("url", uri.AbsoluteUri);
            XmlRpcStruct response = proxy.Ping(call);

            //+
            if (response["flerror"].ToString() == "1")
            {
                throw new ApplicationException(response["message"].ToString());
            }
        }
Пример #6
0
        private void radGridViewSubtitles_DoubleClick(object sender, EventArgs e)
        {
            Encoding subtitleEncoding = Encoding.UTF8;

            if (radGridViewSubtitles.SelectedRows.Count == 1)
            {
                XMLRPCOpenSubtitles.IOpenSubtitles    proxy             = XmlRpcProxyGen.Create <XMLRPCOpenSubtitles.IOpenSubtitles>();
                XMLRPCOpenSubtitles.DownloadSubtitles downloadSubtitles = new XMLRPCOpenSubtitles.DownloadSubtitles();
                XMLRPCOpenSubtitles.LogIn             logIn             = XMLRPCOpenSubtitles.logIn;

                int[] downloadSubtitle = new int[1];

                var idSubtitleFile = radGridViewSubtitles.SelectedRows[0].Cells["IDSubtitleFile"].Value.ToString();
                downloadSubtitle[0] = Convert.ToInt32(idSubtitleFile);

                downloadSubtitles = proxy.DownloadSubtitles(logIn.token, downloadSubtitle);

                byte[] compressedSubtitleData = Convert.FromBase64String(downloadSubtitles.data[0].data);

                var uncompressedSubtitleData = XMLRPCOpenSubtitles.GZipDecompress(compressedSubtitleData, subtitleEncoding);

                var title = MovieTitle;
                // safen title for filename
                Array.ForEach(Path.GetInvalidFileNameChars(),
                              c => title = title.Replace(c.ToString(), String.Empty));

                var extractFolder = Path.Combine(ConfigurationManager.AppSettings["Path.Download"],
                                                 ConfigurationManager.AppSettings["Name.Transfer"], title);

                var subFileName = radGridViewSubtitles.SelectedRows[0].Cells["SubFileName"].Value.ToString();

                // check directory
                if (!Directory.Exists(extractFolder))
                {
                    Directory.CreateDirectory(extractFolder);
                }

                // save subtitle file to disk
                File.WriteAllText(Path.Combine(extractFolder, subFileName), uncompressedSubtitleData, subtitleEncoding);

                toolTipSubtitles.ToolTipTitle = "Successful";
                toolTipSubtitles.ToolTipIcon  = ToolTipIcon.Info;
                toolTipSubtitles.Show(String.Format("Subtitle {0} downloaded successfully", subFileName), radGridViewSubtitles);

                // update image of first column
                radGridViewSubtitles.SelectedRows[0].Cells["#"].Value = "OK";
            }
        }
Пример #7
0
        public OdooService(OdooConnection connection)
        {
            _connection = connection;
            _context    = new OdooContext();

            _context.OdooAuthentication     = XmlRpcProxyGen.Create <IOdooCommon>();
            _context.OdooAuthentication.Url = string.Format(@"{0}{1}", _connection.Url, LoginPath);

            _context.OdooData     = XmlRpcProxyGen.Create <IOdooObject>();
            _context.OdooData.Url = string.Format(@"{0}{1}", _connection.Url, DataPath);

            _context.Database = connection.Database;
            _context.Username = connection.Username;
            _context.Password = connection.Password;
            Login();
        }
Пример #8
0
 private string getSessionKey()
 {
     try
     {
         //sessionValidTill: Seconds since the Unix Epoch, can be used for about 30 minutes
         if ((new DateTime(1970, 1, 1)).AddSeconds(m_sessionValidTill) < DateTime.Now.ToUniversalTime())
         {
             m_apiProxy = (IMMApi)XmlRpcProxyGen.Create(typeof(IMMApi));
             ApiStartSession s = m_apiProxy.StartSession(m_apiKey);
             m_sessionKey       = s.session_key;
             m_sessionValidTill = s.valid_till;
         }
     }
     catch { }
     return(m_sessionKey);
 }
Пример #9
0
    /*
     * We use the constructor to initialize all the XmlRpc stuff. It's fine, and that way you keep the Awake and Start methods clean for your Unity code.
     * */
    public ThalamusUnity()
    {
        Publisher = new ThalamusUnityPublisher(this);

        remoteUri             = String.Format("http://{0}:{1}", remoteAddress, remotePort);
        thalamusProxy         = XmlRpcProxyGen.Create <IIThalamusUnityRpc>();
        thalamusProxy.Timeout = 1000;
        thalamusProxy.Url     = remoteUri;
        thalamusProxy.Url     = remoteUri;
        Debug.Log("Thalamus endpoint set to " + remoteUri);

        dispatcherThread        = new Thread(new ThreadStart(DispatcherThreadThalamus));
        messageDispatcherThread = new Thread(new ThreadStart(MessageDispatcherThalamus));
        dispatcherThread.Start();
        messageDispatcherThread.Start();
    }
Пример #10
0
        public string getKeywordsGroups(int siteId, int campaignId)
        {
            string method    = "site.getKeywordsGroups";
            string salt      = this.generateSalt();
            string timestamp = this.generateTimestamp().ToString();
            string hash      = this.generateHash(this.domain, this.apiKey, method, timestamp, salt);

            Site site = XmlRpcProxyGen.Create <Site>();

            site.Url         = this.apiUrl;
            site.Credentials = new NetworkCredential(this.httpUser, this.httpPasswd);

            object apiResponse = site.getKeywordsGroups(hash, domain, timestamp, salt, siteId, campaignId);

            return(JsonConvert.SerializeObject(apiResponse));
        }
Пример #11
0
        private ProxyManager <TService> CreateProxyManager(XmlRpcResponseEventHandler responseHandler = null)
        {
            var definition = XmlRpcProxyGen.Create <TService>();

// ReSharper disable PossibleInvalidCastException
            var proxy = (IXmlRpcProxy)definition;

// ReSharper restore PossibleInvalidCastException

            proxy.AttachLogger(new MethodListenerXmlRpcLogger(_listenerProvider.GetListener()));

            proxy.Url       = _uri.AbsoluteUri;
            proxy.UserAgent = UserAgent;

            return(new ProxyManager <TService>(definition, responseHandler));
        }
Пример #12
0
        public SubtitlesManager()
        {
            try
            {
                if (!FileManager.DisableOpenSubtitles)
                {
                    m_osdbProxy           = XmlRpcProxyGen.Create <IOSDb>();
                    m_osdbProxy.Url       = "http://api.opensubtitles.org/xml-rpc";
                    m_osdbProxy.KeepAlive = false;
                    m_osdbProxy.Timeout   = 30000;

                    m_Token = Login();
                }
            }
            catch { }
        }
Пример #13
0
        public GroupVPNClient(string username, string group, string secret,
                              string server_uri, string node_address, RSACryptoServiceProvider public_key)
        {
            _username = username;
            _group    = group;
            _secret   = secret;
            _state    = States.Waiting;

            _group_vpn     = (IGroupVPNServer)XmlRpcProxyGen.Create(typeof(IGroupVPNServer));
            _group_vpn.Url = server_uri;

            CertificateMaker cm = new CertificateMaker(string.Empty, string.Empty,
                                                       string.Empty, string.Empty, string.Empty, public_key, node_address);

            _unsigned_cert = cm.UnsignedData;
        }
Пример #14
0
        private IRTorrent BuildClient(RTorrentConfig settings)
        {
            var client = XmlRpcProxyGen.Create <IRTorrent>();

            client.Url =
                $@"{(settings.UseSsl ? "https" : "http")}://{settings.Host}:{settings.Port}/{settings.UrlBase}";

            client.EnableCompression = true;

            if (!string.IsNullOrWhiteSpace(settings.Username))
            {
                client.Credentials = new NetworkCredential(settings.Username, settings.Password);
            }

            return(client);
        }
Пример #15
0
    /// <summary>
    /// Setup this class and any threads/connections needed
    /// </summary>
    private void setup()
    {
        /*if (serverThread == null || !serverThread.IsAlive) { serverThread = new Thread(startThread); }
         *
         * if (!serverThread.IsAlive)
         * {
         *  serverThread.Start();
         * }*/

        /// Client RPC setup
        proxy             = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));
        proxy.Url         = "http://" + client_xml_rpc_url + ":" + client_port + "/";
        proxy.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
        proxy.Timeout     = 5000;
        Debug.Log("Connect");
    }
Пример #16
0
        /// <summary>
        /// Ping搜索引擎
        /// </summary>
        /// <param name="url">url地址(带域名)</param>
        public static void PingSE(string url)
        {
            var ses = SystemSetting.PingAddress.Split('\n');

            foreach (var se in ses)
            {
                try
                {
                    var proxy = XmlRpcProxyGen.Create <IMath>();
                    proxy.Url = se.Trim();

                    proxy.ping(SystemSetting.SiteName, SystemSetting.SiteUrl, url, SystemSetting.SiteUrl + "rss.aspx");
                }
                catch { }
            }
        }
Пример #17
0
        public static Dictionary <string, double> GetKiteStats(string accountId, string credentials)
        {
            object[]   val;
            IPkService proxy = XmlRpcProxyGen.Create <IPkService>();

            try
            {
                val = proxy.get_kite_stats(accountId, credentials);
            }
            catch (Exception e)
            {
                PkLogging.Logger(PkLogging.Level.Error, "Unable to connect to the Pagekite Service"
                                 + Environment.NewLine + "Exception: " + e.Message, true);
                val = null;
            }

            if (val == null)
            {
                return(null);
            }

            string ok = val[0].ToString();

            if (!ok.Equals("ok"))
            {
                PkLogging.Logger(PkLogging.Level.Error, "Unable to update kites");
                return(null);
            }

            XmlRpcStruct kitesStruct = (XmlRpcStruct)val[1];

            Dictionary <string, double> kites = new Dictionary <string, double>();

            foreach (string kite in kitesStruct.Keys)
            {
                try
                {
                    kites[kite] = Convert.ToDouble(kitesStruct[kite]);
                }
                catch (Exception e)
                {
                    kites[kite] = -1;
                }
            }

            return(kites);
        }
Пример #18
0
        private void butGetStateName_Click(object sender, System.EventArgs e)
        {
            labStateName.Text = "";
            IStateName betty = XmlRpcProxyGen.Create <IStateName>();

            Cursor = Cursors.WaitCursor;
            try
            {
                int num = Convert.ToInt32(txtStateNumber.Text);
                labStateName.Text = betty.GetStateName(num);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            Cursor = Cursors.Default;
        }
Пример #19
0
        /// <summary>
        /// 参赛者成绩下载
        /// </summary>
        /// <returns></returns>
        private bool downloadUserTestDetail()
        {
            string mediaUrl = txtFile.Text;
            string usern    = txtUserName.Text;
            string pass     = txtPassword.Text;

            YYTestApi            yyTestApi      = (YYTestApi)XmlRpcProxyGen.Create(typeof(YYTestApi));
            XmlRpcClientProtocol clientProtocol = (XmlRpcClientProtocol)yyTestApi;

            clientProtocol.Url = mediaUrl;
            UserTestDetail[] userTestDetails = yyTestApi.getUserTestDetails(usern, pass);
            foreach (UserTestDetail userTestDetail in userTestDetails)
            {
                int    id           = userTestDetail.id;
                int    userId       = userTestDetail.userId;
                int    testId       = userTestDetail.testId;
                int    questionId   = userTestDetail.QuestionId;
                int    questionType = userTestDetail.QuestionType;
                string Answer       = userTestDetail.Answer;

                if (isUserTestDetailExists(id))
                {
                    string sql = "update [tbl_User_test_detail] set "
                                 + "[userId] =" + userId + ""
                                 + ",[testId]=" + testId + ""
                                 + ",[questionId]=" + questionId + ""
                                 + ",[questionType]=" + questionType + ""
                                 + ",[Answer]='" + Answer + "'"
                                 + " where id=" + id;
                    db.ExeSQL(sql);
                }
                else
                {
                    string sql = "insert into [tbl_User_test_detail]([userId],[testId],[questionId],[QuestionType],[Answer]) values("
                                 + "" + userId + ""
                                 + "," + testId + ""
                                 + "," + questionId + ""
                                 + "," + questionType + ""
                                 + ",'" + Answer + "')";
                    db.ExeSQL(sql);
                }
            }
            lblProgressInfor.Text = "参赛者成绩下载成功!";
            //MessageBox.Show("参赛者成绩下载成功!");
            return(true);
        }
Пример #20
0
        private void openWikiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form fOpen = new OpenWindow();

            if (fOpen.ShowDialog(this) == DialogResult.OK)
            {
                IWikiRpc wiki = XmlRpcProxyGen.Create <IWikiRpc>();
                wiki.Url = MainWindow.WikiRpcUri;
                string[] pages = wiki.getAllPages();
                Array.Sort(pages);
                for (int i = 0; i < pages.Length; ++i)
                {
                    listBoxPages.Items.Add(pages[i]);
                }
            }
            fOpen.Dispose();
        }
Пример #21
0
        public IResultAddNews SendRss(INews ch)
        {
            var rss = (IXmlrpc)XmlRpcProxyGen.Create(typeof(IXmlrpc));

            try
            {
                var ran = rss.AddNews(ch.Chanel, ch.Title, ch.Link, ch.Desc, ch.Creator, ch.Secutiry, ch.Category);
                return(ran);
            }
            catch (XmlRpcFaultException ex)
            {
                var rn = new ResultAddNews {
                    AddNews = ex.FaultCode.ToString(CultureInfo.InvariantCulture), InsertId = ex.FaultString
                };
                return(rn);
            }
        }
Пример #22
0
        public void AsynchronousFaultException()
        {
            IStateName   proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
            IAsyncResult asr   = proxy.BeginGetStateName(100);

            asr.AsyncWaitHandle.WaitOne();
            try
            {
                string ret = proxy.EndGetStateName(asr);
                Assert.Fail("exception not thrown on async call");
            }
            catch (XmlRpcFaultException fex)
            {
                Assert.AreEqual(1, fex.FaultCode);
                Assert.AreEqual("Invalid state number", fex.FaultString);
            }
        }
Пример #23
0
        public string getSites()
        {
            string method    = "company.getSites";
            string salt      = this.generateSalt();
            string timestamp = this.generateTimestamp().ToString();
            string hash      = this.generateHash(this.domain, this.apiKey, method, timestamp, salt);

            Company company = XmlRpcProxyGen.Create <Company>();

            company.Url         = this.apiUrl;
            company.Credentials = new NetworkCredential(this.httpUser, this.httpPasswd);

            object apiResponse = company.getSites(hash, domain, timestamp, salt);

            Console.Write(apiResponse);
            return(JsonConvert.SerializeObject(apiResponse));
        }
        public bool Send()
        {
            string server = "192.168.102.188";
            string port   = "8888";
            string user   = "******";
            string pwd    = "Test123";


            Stopwatch sw = new Stopwatch();

            sw.Start();
            IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));

            sw.Stop();
            Console.WriteLine($"连接耗时:{sw.Elapsed}");

            var paht = $@"\\192.168.102.188\share\testx\AI201701010";

            if (!Directory.Exists(paht))
            {
                Directory.CreateDirectory(paht);
            }


            sw.Reset();
            sw.Start();
            Parallel.For(1, 17, i =>
            {
                Console.WriteLine(i);
                File.Copy($@"C:\Users\sh179\Desktop\testx\{i}.jpg", $@"\\192.168.102.188\share\testx\AI201701010\{i}.jpg", true);
                string message = proxy.getTest($"{i}.jpg");
                Console.WriteLine($"{i} return:{message}");
            });



            //string message = proxy.getTest("123.jpg");
            //Console.WriteLine($"return:{message}");


            sw.Stop();
            Console.WriteLine($"发送耗时:{sw.Elapsed}");


            return(false);
        }
Пример #25
0
        /// <summary>
        /// Inserts a post.
        /// </summary>
        /// <param name="serviceUrl">The service URL of the blog.</param>
        /// <param name="blogId">The blog Id.</param>
        /// <param name="username">The blog username.</param>
        /// <param name="password">The blog password.</param>
        /// <param name="title">The post title.</param>
        /// <param name="content">The post content.</param>
        /// <param name="authorid">The post author id.</param>
        /// <param name="dateCreated">The post creation date.</param>
        /// <param name="categories">The post categories.</param>
        /// <returns>Post object that was created by the server.</returns>
        public Post InsertPost(string serviceUrl, string blogId, string username,
                               string password, string title, string content,
                               string authorid, DateTime dateCreated,
                               List <string> categories)
        {
            Post   results;
            String postResult;
            Post   TestPost;

            IMetaWeblog          proxy = (IMetaWeblog)XmlRpcProxyGen.Create(typeof(IMetaWeblog));
            XmlRpcClientProtocol cp    = (XmlRpcClientProtocol)proxy;

            cp.Url = serviceUrl;

            try
            {
                TestPost             = new Post();
                TestPost.dateCreated = dateCreated;
                TestPost.userid      = authorid;
                TestPost.title       = title;
                TestPost.description = content;
                TestPost.categories  = categories.ToArray();

                postResult = proxy.newPost(blogId, username, password, TestPost, true);

                if (!String.IsNullOrEmpty(postResult))
                {
                    results = proxy.getPost(postResult, username, password);
                }
                else
                {
                    throw new Exception("Post not created.");
                }
            }
            catch (XmlRpcFaultException fex)
            {
                throw fex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(results);
        }
Пример #26
0
        /// <summary>
        /// 试题上传
        /// </summary>
        /// <returns></returns>
        private bool uploadQuestion()
        {
            string mediaUrl = txtFile.Text;
            string usern    = txtUserName.Text;
            string pass     = txtPassword.Text;

            string  sql = "select * from tbl_Question_Single";
            DataSet ds  = db.ReturnDataSet(sql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                QuestionSingle[]     questionSingles = new QuestionSingle[1];
                YYTestApi            yyTestApi       = (YYTestApi)XmlRpcProxyGen.Create(typeof(YYTestApi));
                XmlRpcClientProtocol clientProtocol  = (XmlRpcClientProtocol)yyTestApi;
                clientProtocol.XmlEncoding = System.Text.Encoding.UTF8;
                clientProtocol.Url         = mediaUrl;
                bool result = true;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    questionSingles[0]            = new QuestionSingle();
                    questionSingles[0].id         = Convert.ToInt32(ds.Tables[0].Rows[i]["id"]);
                    questionSingles[0].Content    = ds.Tables[0].Rows[i]["Content"].ToString();
                    questionSingles[0].SelectionA = ds.Tables[0].Rows[i]["SelectionA"].ToString();
                    questionSingles[0].SelectionB = ds.Tables[0].Rows[i]["SelectionB"].ToString();
                    questionSingles[0].SelectionC = ds.Tables[0].Rows[i]["SelectionC"].ToString();
                    questionSingles[0].SelectionD = ds.Tables[0].Rows[i]["SelectionD"].ToString();
                    questionSingles[0].Answer     = ds.Tables[0].Rows[i]["Answer"].ToString();
                    questionSingles[0].Hardness   = ds.Tables[0].Rows[i]["Hardness"].ToString();
                    questionSingles[0].Score      = Convert.ToInt32(ds.Tables[0].Rows[i]["Score"]);
                    result = result && yyTestApi.setQuestionSingles(usern, pass, questionSingles);
                }
                if (!result)
                {
                    lblProgressInfor.Text = "试题上传失败!";
                    //MessageBox.Show("试题上传失败!");
                }
                else
                {
                    lblProgressInfor.Text = "试题上传成功!";
                    //MessageBox.Show("试题上传成功!");
                }
            }

            return(true);
        }
        public string GetCustomers()
        {
            IOpenErpLogin rpcClientLogin = XmlRpcProxyGen.Create <IOpenErpLogin>();

            rpcClientLogin.NonStandard = XmlRpcNonStandard.AllowStringFaultCode;

            //login
            int userId = rpcClientLogin.Login(db, username, password);

            //if(userId > 0)
            //{
            //    return "login ok";
            //} else
            //{
            //    return "login failed";
            //}

            IOpenErpAddFields rpcField = XmlRpcProxyGen.Create <IOpenErpAddFields>();

            //get all customers
            object[] filter = new object[1];
            filter[0] = new object[3] {
                "customer", "=", "true"
            };

            //List fields = new object[1];
            //object[] fieldsParams = new object[2] { "name", "street" };
            //fields = new object[2] { "fields", fieldsParams };

            XmlRpcStruct[]          results   = rpcField.Searchread(db, userId, password, "res.partner", "search_read", filter);
            List <Dto.ShowCustomer> customers = new List <Dto.ShowCustomer>();

            foreach (var res in results)
            {
                string  test = JsonConvert.SerializeObject(res);
                JObject jo   = JObject.Parse(test);

                Dto.ShowCustomer tempCustomer = new Dto.ShowCustomer(jo["name"].ToString(), jo["x_UUID"].ToString(), Int32.Parse(jo["x_timestamp"].ToString()),
                                                                     Int32.Parse(jo["x_version"].ToString()), bool.Parse(jo["x_banned"].ToString()), bool.Parse(jo["active"].ToString()),
                                                                     jo["email"].ToString(), jo["mobile"].ToString(), jo["x_dateofbirth"].ToString(), jo["vat"].ToString());
                customers.Add(tempCustomer);
            }
            return(JsonConvert.SerializeObject(customers) + "\n");
            //return results;
        }
Пример #28
0
        public string getOrganicKeywordsRanking(int siteId, int campaignId, string date,
                                                bool domain_alias, int offset, int limit, bool competitive)
        {
            string method    = "site.getOrganicKeywordsRanking";
            string salt      = this.generateSalt();
            string timestamp = this.generateTimestamp().ToString();
            string hash      = this.generateHash(this.domain, this.apiKey, method, timestamp, salt);

            Site site = XmlRpcProxyGen.Create <Site>();

            site.Url         = this.apiUrl;
            site.Credentials = new NetworkCredential(this.httpUser, this.httpPasswd);

            object apiResponse = site.getOrganicKeywordsRanking(hash, domain, timestamp, salt, siteId,
                                                                campaignId, date, domain_alias, offset, limit, competitive);

            return(JsonConvert.SerializeObject(apiResponse));
        }
        public string Get()
        {
            IOpenErpLogin rpcClientLogin = XmlRpcProxyGen.Create <IOpenErpLogin>();

            rpcClientLogin.NonStandard = XmlRpcNonStandard.AllowStringFaultCode;

            //login
            int userid = rpcClientLogin.login("ErrasmusHB", "*****@*****.**", "kassa");

            if (userid > 0)
            {
                return("login succesful");
            }
            else
            {
                return("fout");
            }
        }
Пример #30
0
 public void run()
 {
     try
     {
         int ack = 5;
         IServiceContract proxy = XmlRpcProxyGen.Create <IServiceContract>();
         proxy.Url = nextNodeOnRing.getFullUrl();
         int respond = proxy.takeTheToken(ack);
         if (respond != ack + 1)
         {
             Console.WriteLine("Token Ring algorithm has failed.");
         }
     } catch (Exception e)
     {
         Console.WriteLine("Token Ring algorithm has failed.");
         Console.WriteLine(e.Message);
     }
 }