2014-02-10 66 views
0

我正在使用vb.net(4.0)與DocuSign API進行交互。我正在嘗試創建一個允許用戶在當前過期日期添加30天的過程,而不是登錄到DocuSign.net來更正信封。該代碼似乎工作正常(不拋出任何錯誤),但校正不發生在DocuSign的一方。DocuSign SOAP API更新(正確)信封過期

Me.EnvelopeID是信封的ID

DocuService是API的DocuSign服務引用的命名空間。

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創建&發送信封,做收件人更新,所以我知道這些都是正確的。我不知道什麼是錯的!

回答

0

這很可能是3種可能性中的1種。

  • 我很驚訝它沒有錯誤,但你不應該把你的accountId放在http auth頭中。請參閱第19頁的SOAP PDF指南: http://www.docusign.com/sites/default/files/DocuSignAPI_Guide.pdf

  • 還有其他的東西沒有正確配置您的SOAP API調用。檢查您的原始傳出請求,並確保您所期望的xml。如果不確定,請在這裏發佈原始請求。

  • DocuSign的一個錯誤。首先排除其他兩種選擇,如果沒有骰子在這裏發表評論,我可以得到一個記錄在DocuSign身邊的bug。另外一個好的測試就是通過REST API進行更正調用,看看你是否可以使用它。

+0

謝謝,我把另一個項目放了一兩個星期,但我很快就會回來。 –