Docusign 侦听器参数 Null(开发沙箱)

Docusign Listener Argument Null (dev Sandbox)

我在 C# web 服务中创建了一个 web 方法,它在 Envelope 状态更改时侦听 Docusign 调用:


[WebMethod]

        public void DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation)
        {
            
            //Check if null
            if (DocuSignEnvelopeInformation == null)
            {
                File.WriteAllText("C:\websites\DataAPI\datalog.txt", "Data: " + "Data is null");
            }
            else
            {
                string envelopeId = "";
                try
                {
                    //Write a line in a file
                    File.WriteAllText("C:\websites\DataAPI\datalog.txt", "Data: " + DocuSignEnvelopeInformation.ToString());
     
                    //Get some data out
                    envelopeId = DocuSignEnvelopeInformation.EnvelopeStatus.EnvelopeID;

                    //Write Data to a file
                    File.WriteAllText("C:\websites\DataAPI\innerdatalog.txt", "Data: " + DocuSignEnvelopeInformation.ToString());


                }
                catch (Exception ex)
                {
                    // could not serialize
                    File.WriteAllText("C:\websites\DataAPI\errorlog.txt", "Exception: " + ex.Message);
                    
                    throw new SoapException(ex.Message, SoapException.ClientFaultCode);
                }

                
            }

我遇到的问题是调用时未设置 DocuSignEnvelopeInformation 参数,因此代码一直在 if==null 语句处终止。当我 运行 使用 SoapUI 将信封数据发送到 API 时,一切正常。任何我遗漏的想法都将不胜感激。

编辑:我也想在这里添加接口,因为我最初忘记了它

    [ServiceContract(ConfigurationName = "IOperations", Namespace = "https://www.docusign.net/API/3.0")]
    public interface IOperations
    {
        
        [OperationContract(Action = "DocuSignConnectListener/Operations/DocuSignConnectUpdate")]
        [XmlSerializerFormat]
        string DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation);
    }

当 DocuSign webhook 设置为使用 SOAP 模式时,通知将作为 SOAP 请求发送到您的服务器(您的侦听器)。

如果 SOAP 模式关闭,则通知将作为带有 XML 正文的常规 POST 请求发送。

在你的问题中,你是这样说的

When I run the envelope data to the API using SoapUI everything works correctly

所以听起来一切都按设计进行。

好吧,我终于想通了,结果发现它不够漂亮,所以我专门加了一个装饰:

[SoapDocumentMethod("http://tempuri.org/DocuSignConnectUpdate",
            RequestNamespace = "http://tempuri.org",
            ResponseNamespace = "http://tempuri.org",
            Use = System.Web.Services.Description.SoapBindingUse.Literal,
            ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

在方法上,现在一切都按预期进行。现在看了,感觉好多了。