コード例 #1
0
        /// <summary>
        /// 文件验章
        /// </summary>
        /// <param name="signCheckFileRequest"></param>
        /// <returns></returns>
        public SignCheckFileResponse checkFile(SignCheckFileRequest 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);

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

            return(signCheckFileResponse);
        }
コード例 #2
0
ファイル: SignCheckTest.cs プロジェクト: aiosign/sign-sdk-net
        /// <summary>
        /// 文件验签
        /// </summary>
        public void checkFile()
        {
            try
            {
                FileUploadRequest fileUploadRequest = new FileUploadRequest("D://contract//签署完成合同.pdf", "签署完成合同.pdf");

                SignCheckFileRequest signCheckFileRequest = new SignCheckFileRequest();
                signCheckFileRequest.fileData     = fileUploadRequest.fileData;
                signCheckFileRequest.fileDataName = fileUploadRequest.fileDataName;

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