Exemplo n.º 1
0
        public void eventCertSignTemplateBatch()
        {
            EventCertSignTemplateBatchRequest signTemplateBatchRequest = new EventCertSignTemplateBatchRequest();

            signTemplateBatchRequest.template_id = "983e7c49532738a14e1d1aeb02d65775";
            EventCertBatchTemplates batchTemplates = new EventCertBatchTemplates();

            batchTemplates.custom_id = "12639f12a9e5374d824b45981f276cc5";

            EventCertSignParams param = new EventCertSignParams();

            param.height   = 50;
            param.width    = 50;
            param.user_id  = "00765245060136194048";
            param.seal_id  = "babeef37549d22cbb50ce5436cdb3037";
            param.sign_key = "sign";
            batchTemplates.addSignParams(param);

            EventCertTextParams textParam = new EventCertTextParams();

            textParam.key   = "day2";
            textParam.value = "批量测试";
            batchTemplates.addTextParams(textParam);

            signTemplateBatchRequest.addBatchTempLate(batchTemplates);

            try
            {
                EventCertSignTemplateBatchResponse response = client.EventCertSign.eventCertSignTemplateBatch(signTemplateBatchRequest);
                Console.WriteLine("事件证书-批量签章-响应数据:" + JSONUtil.getJsonStringFromObject(response));
            }
            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);
            }
        }
Exemplo n.º 2
0
        public void eventCertSignTemplateSingle()
        {
            EventCertSignTemplateSingleRequest signTemplateSingleRequest = new EventCertSignTemplateSingleRequest();

            signTemplateSingleRequest.template_id = "983e7c49532738a14e1d1aeb02d65775";
            EventCertSignField signField = new EventCertSignField();

            EventCertSignParams param = new EventCertSignParams();

            param.height   = 50;
            param.width    = 50;
            param.user_id  = "00765245060136194048";
            param.seal_id  = "babeef37549d22cbb50ce5436cdb3037";
            param.sign_key = "sign";
            signField.addSignParams(param);

            EventCertTextParams textParam = new EventCertTextParams();

            textParam.key   = "name";
            textParam.value = "单测试";
            signField.addTextParams(textParam);

            signTemplateSingleRequest.sign_field = signField;

            try
            {
                EventCertSignTemplateSingleResponse response = client.EventCertSign.eventCertSignTemplateSingle(signTemplateSingleRequest);
                Console.WriteLine("事件证书-单次模板签章-响应数据:" + JSONUtil.getJsonStringFromObject(response));
            }
            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);
            }
        }