2014-01-21 23 views
0

我一直在試圖讓Anchor Tabs通過.NET使用DocuSign SOAP API工作。我已經成功地獲得了正常的選項卡,使用類似的方法工作(當然不包括AnchorTabItem代碼)。Anchor Tabs不適用於通過DocuSign使用.NET SOAP API發送的文檔

當文檔與指定的固定標籤一起發送時,標籤不會顯示在任何收件人的文檔上。相反,每個收件人是能夠把自己的簽名選項卡上的文件,如下圖所示:

docusign anchor tabs

當我嘗試使用web界面上它完美的作品,並發現了一個模板來創建錨接片我在Row("anchorString")變量中指定的文檔上的文本。以下是我用來添加選項卡並將其分配給文檔ID和收件人ID的代碼。 Data.Tab.GetTabsByDocName用於獲取標籤位置和收件人角色。

Dim DT As DataTable = Data.Tab.GetTabsByDocName(DocName) 
    Dim Tabs As New List(Of DemoDocuSign.Tab) 
    For Each Row As DataRow In DT.Rows 
     Dim Tab As New DemoDocuSign.Tab With {.AnchorTabItem = New DemoDocuSign.AnchorTab()} 
     With Tab 
      .Type = [Enum].Parse(GetType(DemoDocuSign.TabTypeCode), Row("type")) 
      .TabLabel = Row("role") 
      .PageNumber = Row("pageNum") 
      .AnchorTabItem.AnchorTabString = Row("anchorString") 
      .AnchorTabItem.IgnoreIfNotPresent = False 
      .AnchorTabItem.IgnoreIfNotPresentSpecified = True 
      .AnchorTabItem.Unit = DemoDocuSign.UnitTypeCode.Cms 
      .AnchorTabItem.UnitSpecified = True 
      .AnchorTabItem.YOffset = Row("yOffset") 
      .AnchorTabItem.XOffset = Row("xOffset") 
     End With 
    Next 
    If Recipients IsNot Nothing Then 
     For Each Recipient In Recipients 
      For Each Tab In Tabs 
       If Recipient.Role = Tab.TabLabel Then 
        Tab.RecipientID = Recipient.RecID 
       End If 
       Tab.DocumentID = Document.DocID 
      Next 
     Next 
     Dim FinalTabs As New List(Of DemoDocuSign.Tab) 
     For Each Tab In Tabs 
      If Tab.RecipientID <> "" Then 
       FinalTabs.Add(Tab) 
      End If 
     Next 
     Tabs = FinalTabs 
    End If 
    Return Tabs 

我不知道爲什麼會發生這種情況,並且我沒有從SOAP端點收到任何錯誤,這些選項卡只是不顯示給收件人。

下面是請求的XML(帶有***省略的敏感信息)。好像沒有被附加在所有選項卡,即使我用同樣的方法,我通常做!:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
    <s:Header> 
     <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
      <u:Timestamp u:Id="_0"> 
       <u:Created>2014-01-21T22:31:01.565Z</u:Created> 
       <u:Expires>2014-01-21T22:36:01.565Z</u:Expires> 
      </u:Timestamp> 
      <o:UsernameToken u:Id="uuid-cfaefba6-85c2-43e5-a3b8-cc6daa8cbf44-1"> 
       <o:Username>***</o:Username> 
       <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">***</o:Password> 
      </o:UsernameToken> 
     </o:Security> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <CreateAndSendEnvelope xmlns="http://www.docusign.net/API/3.0"> 
      <Envelope> 
       <AccountId>***</AccountId> 
       <Documents> 
        <Document> 
         <ID>998</ID> 
         <Name>***.pdf</Name> 
        </Document> 
       </Documents> 
       <Recipients> 
        <Recipient> 
         <ID>1998</ID> 
         <UserName>Martin</UserName> 
         <Email>*@gmail.com</Email> 
         <Type>Signer</Type> 
         <AccessCode xsi:nil="true"/> 
        </Recipient> 
        <Recipient> 
         <ID>1999</ID> 
         <UserName>Test</UserName> 
         <Email>[email protected]</Email> 
         <Type>Signer</Type> 
         <AccessCode xsi:nil="true"/> 
        </Recipient> 
       </Recipients> 
       <Tabs/> 
       <Subject>***</Subject> 
       <EmailBlurb>Please sign the attached document for ****.</EmailBlurb> 
       <Notification> 
        <Reminders> 
         <ReminderEnabled>true</ReminderEnabled> 
         <ReminderDelay>2</ReminderDelay> 
         <ReminderFrequency>2</ReminderFrequency> 
        </Reminders> 
       </Notification> 
      </Envelope> 
     </CreateAndSendEnvelope> 
    </s:Body> 
</s:Envelope> 

編輯:這是因爲我沒有,我沒有Tabs.Add(製表)將每個標籤添加到我的列表中...愚蠢的錯誤!

+0

發送給DocuSign的XML請求必須有錯誤。你能否更新你的問題來包含你的代碼生成的XML請求體(併發送給DocuSign)?您可以使用Fiddler或類似工具輕鬆地生成XML請求的跟蹤。 –

+0

由於某些原因,您的文檔中沒有找到任何錨標籤字符串,因此簽名會話變成了所謂的自由格式簽名會話。基本上,當信封中沒有添加任何選項卡時,您將獲得該下拉列表,並且可以在文檔中隨時添加簽名選項卡。正如Kim所說,添加請求的XML(如果您願意,請刪除文檔字節),這應該有助於診斷問題。 – Ergin

+0

謝謝我已經添加了XML請求 –

回答

1

感謝您發佈XML請求正文。因此,當您的XML請求主體沒有爲收件人指定標籤時,DocuSign的行爲與預期完全相同 - 即它爲收件人提供了「自由格式」的簽名體驗,從而他們可以簡單地將標籤拖放到哪裏他們選擇了。

在你的XML請求,我沒有看到一個角色屬性要麼收件人 - 這可能是你的問題的根源。即在您的代碼中,看起來是否將選項卡添加到集合中取決於Tab.RecipientID正在被填充...這取決於Recipient.Role被填充(並且匹配Tab.TabLabel )。

... 
If Recipient.Role = Tab.TabLabel Then 
    Tab.RecipientID = Recipient.RecID 
End If 
... 
For Each Tab In Tabs 
    If Tab.RecipientID <> "" Then 
     FinalTabs.Add(Tab) 
    End If 
Next 
... 

所以,我建議你通過驗證Recipient.Role被正確填充每個收件人啓動。如果這樣不能解決您的問題,我建議您在調試模式下逐步瀏覽代碼(沿途檢查屬性/集合值),以確定您的數據是什麼(具體來說,內容爲DT.Rows收件人)導致沒有製表符被添加到XML請求。

+0

感謝這個,它使我朝着正確的方向前進,因爲我沒有'Tabs.Add(Tab)''將每個選項卡添加到我的列表中...愚蠢的錯誤! –

相關問題