DocuSign SOAP API更新(更正)信封过期

时间:2014-02-10 15:41:35

标签: vb.net soap docusignapi

我正在使用vb.net(4.0)与DocuSign API进行交互。我正在尝试创建一个允许用户将30天添加到当前到期日期的过程,而不是登录DocuSign.net来更正信封。代码似乎工作正常(不会抛出任何错误),但在DocuSign方面不会发生纠正。

Me.EnvelopeID是信封的ID

DocuService是DocuSign API服务参考的命名空间。

Me.AuthorizationString是用作HTTP标头发送的用户名,密码,帐户号和集成商密钥。

    Private Sub UpdateExpiration()
    'Get envelope details
    Dim orig As DocuService.Envelope = ExecuteSoap(Function(client) client.RequestEnvelope(Me.EnvelopeID, False), Me.AuthorizationString)

    Dim cor As New DocuService.Correction
    cor.EnvelopeID = Me.EnvelopeID
    cor.Reminders = orig.Notification.Reminders
    cor.Expirations = orig.Notification.Expirations
    cor.Expirations.ExpireAfter = (Integer.Parse(orig.Notification.Expirations.ExpireAfter) + 30)


    'Execute Correction
    Dim cord As DocuService.CorrectionStatus = Me.ExecuteSoap(Function(client) client.CorrectAndResendEnvelope(cor), Me.AuthorizationString)
    'If I add a break point on the next line and check the values of cord,
    'there is a returned CorrectionStatus object but every property in the object is "Nothing"

    Dim check As DocuService.Envelope = ExecuteSoap(Function(client) client.RequestEnvelope(Me.EnvelopeID, False), Me.AuthorizationString)
    Console.WriteLine(check.Notification.Expirations.ExpireAfter & " " & (Integer.Parse(orig.Notification.Expirations.ExpireAfter) + 30))
    If check.Notification.Expirations.ExpireAfter = (Integer.Parse(orig.Notification.Expirations.ExpireAfter)) Then
        'Success :)
        MsgBox("success!")
    Else
        'Failure :(
        MsgBox("failure!")
    End If
    End Sub


Private Function ExecuteSoap(Of TResult)(func As Func(Of DSAPIServiceSoapClient, TResult), authorizationString As String) As TResult
    Using client As New DocuService.DSAPIServiceSoapClient(My.Settings.DocusignMode)
        Using scope As OperationContextScope = New System.ServiceModel.OperationContextScope(client.InnerChannel)
            Dim hp As HttpRequestMessageProperty = New HttpRequestMessageProperty
            hp.Headers.Add("X-Docusign-Authentication", authorizationString) 
          OperationContext.Current.OutgoingMessageProperties(HttpRequestMessageProperty.Name) = hp
            Return If(func IsNot Nothing, func(client), Nothing)
        End Using
    End Using
End Function

我们使用相同的ExecuteSOAP函数和AuthorizationString来创建&发送信封,并进行收件人更新,所以我知道这些是正确的。我不确定什么是错的!

1 个答案:

答案 0 :(得分:0)

这很可能是3种可能中的一种。

  • 我很惊讶它没有错误,但你不应该将你的accountId放在http auth标头中。请参阅第19页的SOAP PDF指南: http://www.docusign.com/sites/default/files/DocuSignAPI_Guide.pdf

  • 您的SOAP API调用还没有正确配置其他内容。检查原始传出请求并确保xml符合您的预期。如果不确定,请在此处发布原始请求。

  • DocuSign的错误。首先排除其他两个选项,如果没有骰子仍然在这里发表评论,我可以在DocuSign方面记录一个错误。另外一个很好的测试是通过REST api进行更正调用,看看你是否可以使用它。