Docusign Listener Argument Null(开发沙箱)

杰森·D

我在C#网络服务中创建了一个网络方法,当信封状态更改时,该方法侦听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);
    }

杰森·D

好的,我终于弄清楚了,结果发现它还不够漂亮,所以我专门添加了一个装饰:

[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)]

在方法上,现在一切都按预期工作。现在,我来看它,它变得更有意义了。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章