2014-03-05 80 views
0

将下列XML提交给DocuSign API时,我收到“INVALID_EMAIL_ADDRESS_FOR_RECIPIENT”错误。我试过手动更改地址并为每个签名者使用不同的地址。为什么当我可以将电子邮件发送到任何我已直接尝试电子邮件的地址时,该请求会返回无效地址?Docusign无效的电子邮件

String [] emailaddr4 = new String {"[email protected]", "[email protected]", "[email protected]", "[email protected]"}; 

String xml = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" + 
       "<accountId>" + accountId + "</accountId>" + 
       "<status>sent</status>" + 
       "<emailSubject>" + emailSubject + "</emailSubject>" + 
       "<emailBlurb>" + emailBlurb + "</emailBlurb>" + 
       "<templateId>81bcad0d-****-****-****-f281b24a4567</templateId>" + 
       "<templateRoles>" + 
        "<templateRole>" + 
         "<email>" + emailaddr4[0] + "</email>" + 
         "<userName>" + emailaddr4[0] + "</userName>" + 
         "<name>" + names[0] + "</name>" + 
         "<roleName>Student</roleName>" + 
         "<clientUserId>1</clientUserId>" + 
         "<tabs>" + 
          "<textTabs>" + 
           "<text>" + 
            "<tabLabel>sid</tabLabel>" + 
            "<value>" + student_id + "</value>" + 
           "</text>" + 
          "</textTabs>" + 
         "</tabs>" + 
        "</templateRole>" + 
        "<templateRole>" + 
         "<email>" + emailaddr4[1] + "</email>" + 
         "<name>" + names[1] + "</name>" + 
         "<roleName>Advisor</roleName>" + //must match role in envelope 
         "<userName>" + emailaddr4[1] + "</userName>" + 
         "<routingOrder>1</routingOrder>" + 
        "</templateRole>" + 
        "<templateRole>" + 
         "<email>" + emailaddr4[2] + "</email>" + 
         "<name>" + names[2] + "</name>" + 
         "<roleName>DeptHead</roleName>" + 
         "<userName>" + emailaddr4[2] + "</userName>" + 
         "<routingOrder>2</routingOrder>" + 
        "</templateRole>" + 
        "<templateRole>" + 
         "<email>" + emailaddr4[3] + "</email>" + 
         "<name>" + names[3] + "</name>" + 
         "<roleName>Dean</roleName>" + 
         "<userName>" + emailaddr4[3] + "</userName>" + 
         "<routingOrder>3</routingOrder>" + 
        "</templateRole>" + 
       "</templateRoles>" + 
      "</envelopeDefinition>"; 

这里是写入DataOutputSteam

<envelopeDefinition xmlns="http://www.docusign.com/restapi"> 
    <accountId>******</accountId> 
    <status>sent</status> 
    <emailSubject>This is a test.</emailSubject> 
    <emailBlurb>Java DS Test</emailBlurb> 
    <templateId>81bcad0d-****-****-****-f281b24a4567</templateId> 
    <templateRoles> 
     <templateRole> 
      <email>[email protected]</email> 
      <userName>[email protected]</userName> 
      <name>Tester</name> 
      <roleName>Student</roleName> 
      <clientUserId>1</clientUserId> 
      <tabs> 
       <textTabs> 
        <text> 
         <tabLabel>sid</tabLabel> 
         <value>6644</value> 
        </text> 
       </textTabs> 
      </tabs> 
     </templateRole> 
     <templateRole> 
      <email>[email protected]</email> 
      <name>Alan advisor</name> 
      <roleName>Advisor</roleName> 
      <userName>[email protected]</userName> 
      <routingOrder>1</routingOrder> 
      </templateRole> 
     <templateRole> 
      <email>[email protected]</email> 
      <name>CTS</name> 
      <roleName>DeptHead</roleName> 
      <userName>[email protected]</userName> 
      <routingOrder>2</routingOrder> 
     </templateRole> 
     <templateRole> 
      <email>[email protected]</email> 
      <name>Jennifer</name> 
      <roleName>Dean</roleName> 
      <userName>[email protected]</userName> 
      <routingOrder>3</routingOrder> 
     </templateRole> 
    </templateRoles> 
</envelopeDefinition> 

这是响应请求的模板收件人时,实际的XML。

<recipients xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
    <agents/> 
    <carbonCopies/> 
    <certifiedDeliveries/> 
    <editors/> 
    <inPersonSigners/> 
    <intermediaries/> 
    <recipientCount>4</recipientCount> 
    <signers> 
     <signer> 
      <recipientId>9d44f02b-****-****-****-db256768d013</recipientId> 
      <recipientIdGuid>9d44f02b-****-****-****-db256768d013</recipientIdGuid> 
      <requireIdLookup>false</requireIdLookup> 
      <roleName>Student</roleName> 
      <routingOrder>1</routingOrder> 
      <status>created</status> 
      <templateLocked>false</templateLocked> 
      <templateRequired>true</templateRequired> 
      <email/> 
      <name/> 
      <signInEachLocation>false</signInEachLocation> 
     </signer> 
     <signer> 
      <recipientId>3a1f0ff1-****-****-****-bbecca30dc1a</recipientId> 
      <recipientIdGuid>3a1f0ff1-****-****-****-bbecca30dc1a</recipientIdGuid> 
      <requireIdLookup>false</requireIdLookup><roleName>DeptHead</roleName> 
      <routingOrder>3</routingOrder> 
      <status>created</status> 
      <templateLocked>false</templateLocked> 
      <templateRequired>true</templateRequired> 
      <email/> 
      <name/> 
      <signInEachLocation>false</signInEachLocation> 
     </signer> 
     <signer> 
      <recipientId>2dd69109-****-****-****-4773cabe5632</recipientId> 
      <recipientIdGuid>2dd69109-****-****-****-4773cabe5632</recipientIdGuid> 
      <requireIdLookup>false</requireIdLookup> 
      <roleName>Advisor</roleName> 
      <routingOrder>2</routingOrder> 
      <status>created</status> 
      <templateLocked>false</templateLocked> 
      <templateRequired>true</templateRequired> 
      <email/> 
      <name/> 
      <signInEachLocation>false</signInEachLocation> 
     </signer> 
     <signer> 
      <recipientId>085d8e2c-****-****-****-bdd92344e257</recipientId> 
      <recipientIdGuid>085d8e2c-****-****-****-bdd92344e257</recipientIdGuid> 
      <requireIdLookup>false</requireIdLookup><roleName>Dean</roleName> 
      <routingOrder>4</routingOrder> 
      <status>created</status> 
      <templateLocked>false</templateLocked> 
      <templateRequired>true</templateRequired> 
      <email/> 
      <name/> 
      <signInEachLocation>false</signInEachLocation> 
     </signer> 
    </signers> 
</recipients> 
+0

您可以更新您的问题发布这类线路上的实际发送请求的XML痕迹? (你可以使用像Fiddler之类的工具轻松地生成一个请求跟踪。) –

+0

@KimBrandl Kim我用代码填充版本更新了原始问题,希望能够提供更多信息。 – user2573754

+0

重新解决了您的问题,并在我的答案中提出了解决方案。 –

回答

2

我可以重现此错误信息,如果我试图创建/使用模板,在模板指定所需每个接收者角色发送信封,但我不指定正确/完整的收件人角色名在我的创建信封请求中。

例如,我在的DocuSign模板指定两个接受者角色 - Signer1Signer2 - 都需要这两者:

DS Recipient Roles

补充说明一下 - 如果我这样做a 获取收件人对模板的API请求,响应还显示需要两个收件人角色(templateRequired = true):

{ 
    signers: [ 
     { 
      signInEachLocation: "false" 
      name: "" 
      email: "" 
      recipientId: "f1b5d256-d85c-42d3-b081-913fb93e13a7" 
      recipientIdGuid: "f1b5d256-d85c-42d3-b081-913fb93e13a7" 
      requireIdLookup: "false" 
      routingOrder: "1" 
      roleName: "Signer1" 
      status: "created" 
      templateLocked: "false" 
      templateRequired: "true" 
     } 
     { 
      signInEachLocation: "false" 
      name: "" 
      email: "" 
      recipientId: "79e8bc34-6a40-4cc5-90e1-e58d9707418e" 
      recipientIdGuid: "79e8bc34-6a40-4cc5-90e1-e58d9707418e" 
      requireIdLookup: "false" 
      routingOrder: "2" 
      roleName: "Signer2" 
      status: "created" 
      templateLocked: "false" 
      templateRequired: "true" 
     } 
    ] 
    agents: [ ] 
    editors: [ ] 
    intermediaries: [ ] 
    carbonCopies: [ ] 
    certifiedDeliveries: [ ] 
    inPersonSigners: [ ] 
    recipientCount: "2" 
} 

现在让我们假设我送下面的“创建信封从模板” API请求,并使用了错误的角色名称为第二收件人:

<envelopeDefinition xmlns="http://www.docusign.com/restapi"> 
    <accountId>a673cd1a-***-****-****-6f4bf80e54sd</accountId> 
    <status>sent</status> 
    <templateId>3C9D42D3-3E76-4669-861E-9670415E1AD3</templateId> 
    <templateRoles> 
     <templateRole> 
     <email>[email protected]</email> 
     <name>John Doe</name> 
     <roleName>Signer1</roleName> 
     </templateRole> 
     <templateRole> 
     <email>[email protected]</email> 
     <name>Jane Doe</name> 
     <roleName>RoleNameDoesntMatchWhatTheTemplateSpecifies</roleName> 
     </templateRole> 
    </templateRoles> 
</envelopeDefinition> 

响应包含此错误:

<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
    <errorCode>INVALID_EMAIL_ADDRESS_FOR_RECIPIENT</errorCode> 
    <message>The email address for the recipient is invalid. The recipient Id follows.</message> 
</errorDetails> 

基于此测试,我建议您验证您的“Create Envelope”API请求是指定模板定义的所有必需收件人角色的收件人信息,并且还确认每个收件人的值为<roleName>您的API请求确切匹配(包括拼写和大小写)模板中定义的角色名称。

**** --------更新#1 - 2014年3月6日---------- ****

感谢您更新您的答案包括您遇到问题的模板的“获取收件人”响应。这种反应表明,模板定义了4个中的接受者角色:

<roleName>Student</roleName> 
<roleName>DeptHead</roleName> 
<roleName>Advisor</roleName> 
<roleName>Dean</roleName> 

你“创建信封从模板”要求供应信息4个接受者角色 - 但在请求中的4个角色名称的2是不正确的(即做不匹配模板定义的角色名称)。下面是你在你的“创建信封从模板”要求提供的角色:

<roleName>Student</roleName> 
<roleName>Advisor</roleName> 
<roleName>Dept Head of Major</roleName> 
<roleName>Dean of School</roleName> 

要解决你得到的错误,你需要做的角色名称在“创建信封从模板”要求完全匹配您的模板定义的角色名称。即,在 “创建信封从模板” 要求,您需要更改如下:

  • 变化<ROLENAME>专业部门主管 </ROLENAME >到<ROLENAME> DeptHead </ROLENAME >

  • 变化<学校的ROLENAME > 院长</ROLENAME >到<ROLENAME> 迪安 </ROLENAME >

**** --------更新#2 - 2014年3月6日------- --- ****

要进一步解决,我建议你:

  • 编辑中的DocuSign模板,使每个接收者角色必需 - 即,对于每个收件人角色,取消勾选“发件人无法删除收件人”复选框(显示在我的原始答案的第一张截图中)。对所有四个收件人角色进行此更改后保存该模板。

  • 接下来,提交您的“Create Envelope”API请求。如果请求成功(即没有错误响应),那么这支持我怀疑您的请求中的收件人信息与某些模板角色不匹配。 (即使是这种情况 - 即没有错误 - 您仍然需要找出哪个角色导致了问题,因为即使您的API请求能够成功创建Envelope,它也可能只用于某些四个收件人 - 不匹配的角色将从信封中删除)。

其次,要弄清楚哪个角色是造成问题:

  1. 编辑该模板检查“发件人无法删除收件人” 复选框的第一个角色,拯救模板。

  2. 接下来,提交您的“Create Envelope”API请求。如果请求 成功(即没有错误响应),那么您刚刚制作的角色 是而不是是导致问题的原因之一。如果请求 失败(即,错误消息“INVALID E-Mail”),则发现导致您的问题的角色 。在这种情况下,我可能会尝试从模板中删除角色 ,再次将其添加回模板,然后 验证角色名称是否与您在API中发送的内容完全匹配(区分大小写)请求并重新尝试API请求。

  3. 返回到第1步,为模板中的下一个角色重复此过程...继续重复,直到您完成所有4个角色的这些步骤(即,所有4个角色再次由模板需要)。

+0

对每个角色的要求转变的建议是非常棒的。我没有意识到可以完成或者已经完成。问题最终是XML中的routingOrder与仪表板/模板中roleName的路由顺序不匹配。 routingOrder必须匹配模板中的内容。 – user2573754

+0

很高兴听到你已经想通了 - 谢谢你的更新。作为一个附注 - 我认为你甚至不需要在Create Envelope API请求中为每个收件人提供路由指令(因为模板已经为收件人指定了路由指令)。 –

相关问题