/// <summary> /// 调用WebService请求数据 /// </summary> /// <param name="context"></param> /// <param name="action"></param> /// <param name="method"></param> /// <param name="token"></param> /// <returns></returns> private string CallWebService(HttpContext context, string action, string method, string token) { string callBackUrl = context.Request.Url.ToString().Substring(0, context.Request.Url.ToString().IndexOf('?') - 1) + "/CommonHandler.ashx"; var dicParamWebService = GetWebServiceParam(context, action, method, token, callBackUrl); try { string url = AppSettingInfo.WorkflowServerUrl; string bizWFServiceURL = context.Request.Form["BizWFURL"]; if (!string.IsNullOrEmpty(bizWFServiceURL)) { url = bizWFServiceURL; } string workFlowServerFullURL = SDKHelper.GetWorkflowServerUrlFullPath(url); var result = SDKHelper.QueryPostWebService(workFlowServerFullURL, AppSettingInfo.CONST_WorkflowServiceMethodName, dicParamWebService); return(result); } catch (Exception ex) { SDKSystemSupportException newEX = new SDKSystemSupportException(ClientConstDefine.WORKFLOW_SERVICE_ERRORCODE_USERSELECT_SERVERWEBSERVICEERROR , ClientConstDefine.WORKFLOW_SERVICE_ERRORCONTENT_USERSELECT_SERVERWEBSERVICEERROR ); throw (Exception)ex; } }
/// <summary> /// 执行流程方法 /// </summary> /// <param name="methodName">方法名称</param> /// <param name="methodMode">方法类型(0:直接提交,1:第一步提交,2:第二步提交)</param> /// <param name="methodVersion">方法版本</param> /// <param name="bizContext">流程上下文参数</param> /// <returns></returns> internal static string ExecuteMethod(string methodName, int methodMode, string methodVersion, BizContext bizContext, string bizWFServiceURL = "") { //补充BizContext的信息(CurrentUser,AppCode) WFClientProcess.RepaireBizContext(bizContext); //将appCode,action,method,param(序列化后的dicParam)添加到dicParamWebService中调用WebService var dicParamWebService = new Dictionary <string, object>(); dicParamWebService.Add("appCode", bizContext.AppCode); dicParamWebService.Add("action", "Process"); dicParamWebService.Add("method", methodName); dicParamWebService.Add("token", bizContext.WFToken); dicParamWebService.Add("param", Newtonsoft.Json.JsonConvert.SerializeObject(new { BizContext = JsonConvert.SerializeObject(bizContext), Mode = methodMode, Version = methodVersion })); dicParamWebService.Add("callBackUrl", ""); string url = AppSettingInfo.WorkflowServerUrl; if (!string.IsNullOrEmpty(bizWFServiceURL)) { url = bizWFServiceURL; } string workFlowServerFullURL = SDKHelper.GetWorkflowServerUrlFullPath(url); string result = SDKHelper.QueryPostWebService(workFlowServerFullURL, AppSettingInfo.CONST_WorkflowServiceMethodName, dicParamWebService); return(result); }
/// <summary> /// 请求WebService返回结果 /// </summary> /// <typeparam name="T">返回的结果类型</typeparam> /// <param name="dicParamWebService">WebService返回结果</param> /// <returns></returns> private static T PostWebServiceGetResult <T>(Dictionary <string, object> dicParamWebService) { string result = SDKHelper.QueryPostWebService(dicParamWebService); ResultBaseContext baseContext = JsonConvert.DeserializeObject <ResultBaseContext>(result); if (baseContext.StatusCode == ClientConstDefine.WORKFLOW_SERVICE_ERRORCODE_NOERROR) { return(JsonConvert.DeserializeObject <T>((string)baseContext.Data)); } else { throw new Exception(baseContext.StatusMessage, baseContext.LastException); } }
/// <summary> /// 检查是否发起过流程 /// </summary> /// <param name="businessID">业务ID</param> /// <returns></returns> internal static bool Exist(string businessID) { var dicParamWebService = SDKHelper.BuildParamWebService(AppSettingInfo.CONST_Action_ProcessOperator, AppSettingInfo.CONST_OtherMethod_ExistProcess, Guid.NewGuid().ToString(), Newtonsoft.Json.JsonConvert.SerializeObject(new { BusinessID = businessID, })); string result = SDKHelper.QueryPostWebService(dicParamWebService); ResultBaseContext baseContext = JsonConvert.DeserializeObject <ResultBaseContext>(result); if (baseContext.StatusCode == ClientConstDefine.WORKFLOW_SERVICE_ERRORCODE_NOERROR) { return((string)baseContext.Data == Boolean.TrueString); } else { throw new Exception(baseContext.StatusMessage, baseContext.LastException); } }