示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //http://localhost:8080/resourceService/gateway?action=connect&userid=admin&password=Se4tMaQCi9gr0Q2usp7P56Sk5vM=
            var args = new Dictionary <string, string>
            {
                { "action", "connect" },
                { "userid", "admin" },
                { "password", "Se4tMaQCi9gr0Q2usp7P56Sk5vM=" }
            };

            BOORouterClient.PostAndFetch("http://localhost:8080/resourceService/gateway", args, out string res);
            Console.WriteLine(res);
        }
 public static bool DoRouter(string toRouterName, Dictionary <string, string> args, string responseRouterName)
 {
     try
     {
         if (BOORouterTable.GetRouterToURL(toRouterName, out string routerGateway))
         {
             BOORouterClient.PostAndFetch(routerGateway, args, out string responseStr);
             if (!String.IsNullOrEmpty(responseRouterName))
             {
                 if (BOORouterTable.GetRouterToURL(responseRouterName, out string responseGateway))
                 {
                     if (args.ContainsKey("uuid"))
                     {
                         var responseDict = new Dictionary <string, string>()
                         {
                             { "uuid", args["uuid"] }
                         };
                         BOORouterClient.PostAndFetch(responseGateway, responseDict, out string tres);
                         return(true);
                     }
                     else
                     {
                         LogUtils.AsyncLogLine("Response router failed, argument uuid not exist in dictionary", "BOORoutering",
                                               LogLevel.Error);
                         return(false);
                     }
                 }
                 else
                 {
                     LogUtils.AsyncLogLine("Response router failed, router not exist: " + responseRouterName, "BOORoutering",
                                           LogLevel.Error);
                     return(false);
                 }
             }
             return(true);
         }
         else
         {
             LogUtils.AsyncLogLine("Fetch router failed, router not exist: " + toRouterName, "BOORoutering",
                                   LogLevel.Error);
             return(false);
         }
     }
     catch (Exception ex)
     {
         LogUtils.AsyncLogLine("Routering failed, with CLR ERROR: " + ex, "BOORoutering",
                               LogLevel.Error);
         return(false);
     }
 }