Beispiel #1
0
        public virtual Object InvokeWCFService(string controller, string method, string jsondata)
        {
            if (string.IsNullOrEmpty(jsondata))
            {
                jsondata = "[]";
            }
            string retJson = WcfClientManage.Request(_pluginName + "@" + controller, method, jsondata);

            object Result = JsonConvert.DeserializeObject(retJson);
            int    ret    = Convert.ToInt32(((Newtonsoft.Json.Linq.JObject)(Result))["flag"]);
            string msg    = ((Newtonsoft.Json.Linq.JObject)(Result))["msg"].ToString();

            if (ret == 1)
            {
                throw new Exception(msg);
            }
            else
            {
                return(((Newtonsoft.Json.Linq.JObject)(Result))["data"]);
            }
        }
Beispiel #2
0
        public virtual Object InvokeWCFServiceCompress(string controller, string method, string jsondata)
        {
            if (string.IsNullOrEmpty(jsondata))
            {
                jsondata = "[]";
            }
            jsondata = ZipComporessor.Compress(jsondata);//压缩传入参数
            string retJson = WcfClientManage.Request(_pluginName + "@" + controller, method, jsondata);

            object Result = JavaScriptConvert.DeserializeObject(retJson);
            int    ret    = Convert.ToInt32(((Newtonsoft.Json.JavaScriptObject)(Result))["flag"]);
            string msg    = ((Newtonsoft.Json.JavaScriptObject)(Result))["msg"].ToString();

            if (ret == 1)
            {
                throw new Exception(msg);
            }
            else
            {
                //解压输出结果
                return(JavaScriptConvert.DeserializeObject(ZipComporessor.Decompress(((Newtonsoft.Json.JavaScriptArray)((Newtonsoft.Json.JavaScriptObject)(Result))["data"])[0].ToString())));
            }
        }