Beispiel #1
0
        /// <summary>
        /// 文件验章V2
        /// </summary>
        /// <param name="signCheckFileRequest"></param>
        /// <returns></returns>
        public SignCheckFileV2Response CheckFileV2(SignCheckFileV2Request request)
        {
            if (
                request.fileData == null || request.fileData.Length == 0 ||
                request.fileDataName == null || request.fileDataName.Trim() == string.Empty
                )
            {
                BaseSignResponse baseSignResponse = new BaseSignResponse();
                baseSignResponse.result_code    = "4001";
                baseSignResponse.result_message = "参数校验异常";
                throw new SignServerException("参数校验异常", baseSignResponse, JSONUtil.getJsonStringFromObject(request));
            }

            FileInfo info = new FileInfo();

            info.fileData = request.fileData;
            info.fileName = request.fileDataName;
            info.key      = "file";

            Dictionary <string, string> @params = new Dictionary <string, string>();

            @params.Add("file_name", request.fileDataName);

            SignCheckFileV2Response signCheckFileResponse = base.FileUpload <SignCheckFileV2Response>(ApiUrlConstant.SignCheck.CheckFileV2, info, @params);

            return(signCheckFileResponse);
        }
Beispiel #2
0
        /// <summary>
        /// 文件验章V2
        /// </summary>
        public void checkFileV2()
        {
            try
            {
                FileUploadRequest fileUploadRequest = new FileUploadRequest("D://contract//签署完成合同.pdf", "签署完成合同.pdf");

                SignCheckFileV2Request request = new SignCheckFileV2Request();
                request.fileData     = fileUploadRequest.fileData;
                request.fileDataName = fileUploadRequest.fileDataName;

                SignCheckFileV2Response signCheckFileResponse = client.SignCheck.CheckFileV2(request);
                Console.WriteLine("文件验章V2-响应数据:" + JSONUtil.getJsonStringFromObject(signCheckFileResponse));
            }
            catch (SignApplicationException sae)
            {
                // 捕获网关校验数据
                Console.WriteLine("文件验章V2-网关异常状态码为:" + sae.return_code);
                Console.WriteLine("文件验章V2-网关异常信息为:" + sae.return_message);
            }
            catch (SignServerException sse)
            {
                // 捕获网关校验数据
                Console.WriteLine("文件验章V2-业务异常状态码为:" + sse.result_code);
                Console.WriteLine("文件验章V2-业务异常信息为:" + sse.result_message);
            }
            catch (Exception e)
            {
                Console.WriteLine("文件验章V2-异常为:" + e.Message);
            }
        }