public void sendApiRequestAsync( Dictionary <object, object> context, RequestInputModel paramBean, ResponseCallBack callback) { string validate = paramBean != null?paramBean.validateParam() : ""; EvnContext evnContext = (EvnContext)context[QSConstant.EVN_CONTEXT_KEY]; string evnValidate = evnContext.validateParam(); if (!QSStringUtil.isEmpty(validate) || !QSStringUtil.isEmpty(evnValidate)) { if (QSStringUtil.isEmpty(validate)) { validate = evnValidate; } OutputModel Out = QSParamInvokeUtil.getOutputModel(callback); QSHttpRequestClient.fillResponseCallbackModel(QSConstant.REQUEST_ERROR_CODE, validate, Out); callback.onAPIResponse(Out); } else { HttpWebRequest request = buildRequest(context, paramBean); QSHttpRequestClient.getInstance() .requestActionAsync(request, evnContext.isSafeOkHttp(), callback); } }
public OutputModel sendApiRequest(Dictionary <object, object> context, RequestInputModel paramBean, Type outputClass) { string validate = paramBean != null?paramBean.validateParam() : ""; EvnContext evnContext = (EvnContext)context[QSConstant.EVN_CONTEXT_KEY]; string evnValidate = evnContext.validateParam(); if (!QSStringUtil.isEmpty(validate) || !QSStringUtil.isEmpty(evnValidate)) { if (QSStringUtil.isEmpty(validate)) { validate = evnValidate; } try { OutputModel model = (OutputModel)Activator.CreateInstance(outputClass); QSHttpRequestClient.fillResponseCallbackModel(QSConstant.REQUEST_ERROR_CODE, validate, model); return(model); } catch (Exception e) { logger.Fatal(e.Message); throw new QSException(e.Message); } } else { HttpWebRequest request = buildRequest(context, paramBean); return(QSHttpRequestClient.getInstance().requestAction(request, evnContext.isSafeOkHttp(), outputClass)); } }