我是 DocuSign API 编程的初学者。我有一个.cshtml
页面用于创建信封以便发送给客户。当我尝试从DocuSign API创建信封时,它会显示错误消息,如:
标签元素中未指定页码。选项卡\" SignHere \"。"
缺少页码或AnchorTabItem
请参阅下面的HTML和代码。
Html
<span>
<br />
<br />
<span><b>SIGNATURE:</b></span> <span style="color:white;">pleasesignhereBP</span>
<br />
<br />
<span><b>DATE:</b></span><span style="color:white;">pleasedatehereBP</span>
<br />
<br />
</span>
代码
SignerModel objPerson = new SignerModel();
TabsModel objPersonTab = new TabsModel();
List<SignHereModel> lstPersonSignHere = new List<SignHereModel>();
SignHereModel objPersonSignHere = new SignHereModel();
objPersonSignHere.DocumentId = "1";
objPersonSignHere.PageNumber = "1";
objPersonSignHere.RecipientId = "2";
objPersonSignHere.AnchorString = "pleasesignhereBP";
objPersonSignHere.AnchorXOffset = ".2";
objPersonSignHere.AnchorYOffset = ".01";
objPersonSignHere.AnchorIgnoreIfNotPresent = "true";
objPersonSignHere.AnchorUnits = "cms";
lstPersonSignHere.Add(objPersonSignHere);
objPersonTab.SignHereTabs = lstPersonSignHere;
List<DateModel> lstPersonDateHere = new List<DateModel>();
DateModel objPersonDate = new DateModel();
objPersonDate.DocumentId = "1";
objPersonDate.PageNumber = "1";
objPersonDate.RecipientId = "1";
objPersonDate.AnchorString = "pleasedatehereBP";
objPersonDate.AnchorXOffset = ".2";
objPersonDate.AnchorYOffset = ".01";
objPersonDate.AnchorIgnoreIfNotPresent = "true";
objPersonDate.AnchorUnits = "cms";
objPersonDate.Value = DateTime.Now.ToShortDateString();
lstPersonDateHere.Add(objPersonDate);
objPersonTab.DateTabs = lstPersonDateHere;
objPerson.Tabs = objPersonTab;
我已经添加了 objPersonDate.PageNumber =&#34; 1&#34; ,但它无效。
我的项目解决方案中有DocuSign.eSign库。我把这个项目称为我的webapplication。然后我对SetDocuSignSigners
类的DocuSignCommunicator
函数进行了一些更改。
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
请参阅下面的详细代码。
private List<Signer> SetDocuSignSigners(List<SignerModel> lstSignerModel)
{
List<Signer> lstSigner = new List<Signer>();
if (lstSignerModel != null && lstSignerModel.Count > 0)
{
foreach (SignerModel objModel in lstSignerModel)
{
Signer objSigner = new Signer();
objSigner.Name = objModel.Name;
objSigner.Email = objModel.Email;
objSigner.RecipientId = objModel.RecipientId;
objSigner.RoutingOrder = objModel.RoutingOrder;
Tabs objTab = new Tabs();
List<SignHere> lstSalesSignHere = new List<SignHere>();
List<DateSigned> lstSalesDateHere = new List<DateSigned>();
List<FullName> lstSalesNameHere = new List<FullName>();
if (objModel.Tabs != null)
{
if (objModel.Tabs.SignHereTabs != null && objModel.Tabs.SignHereTabs.Count > 0)
{
foreach (SignHereModel objSignHere in objModel.Tabs.SignHereTabs)
{
SignHere objSHere = new Model.SignHere();
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
objSHere.AnchorString = objSignHere.AnchorString;
objSHere.DocumentId = objSignHere.DocumentId;
objSHere.RecipientId = objSignHere.RecipientId;
objSHere.AnchorXOffset = objSignHere.AnchorXOffset;
objSHere.AnchorYOffset = objSignHere.AnchorYOffset;
objSHere.AnchorUnits = objSignHere.AnchorUnits;
objSHere.AnchorIgnoreIfNotPresent = objSignHere.AnchorIgnoreIfNotPresent;
objSHere.AnchorMatchWholeWord = "true";
lstSalesSignHere.Add(objSHere);
}
}
if (objModel.Tabs.DateTabs != null && objModel.Tabs.DateTabs.Count > 0)
{
foreach (DateModel objDateHere in objModel.Tabs.DateTabs)
{
DateSigned objDSHere = new DateSigned();
objDSHere.PageNumber = (!string.IsNullOrEmpty(objDSHere.PageNumber)) ? objDSHere.PageNumber : "1";
objDSHere.AnchorString = objDateHere.AnchorString;
objDSHere.DocumentId = objDateHere.DocumentId;
objDSHere.RecipientId = objDateHere.RecipientId;
objDSHere.AnchorXOffset = objDateHere.AnchorXOffset;
objDSHere.AnchorYOffset = objDateHere.AnchorYOffset;
objDSHere.AnchorUnits = objDateHere.AnchorUnits;
objDSHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objDSHere.AnchorMatchWholeWord = "true";
////objDSHere.Value = objDateHere.Value;
lstSalesDateHere.Add(objDSHere);
}
}
if (objModel.Tabs.FullNameTabs != null && objModel.Tabs.FullNameTabs.Count > 0)
{
foreach (FullNameModel objDateHere in objModel.Tabs.FullNameTabs)
{
FullName objNameHere = new FullName();
objNameHere.PageNumber = (!string.IsNullOrEmpty(objNameHere.PageNumber)) ? objNameHere.PageNumber : "1";
objNameHere.AnchorString = objDateHere.AnchorString;
objNameHere.DocumentId = objDateHere.DocumentId;
objNameHere.RecipientId = objDateHere.RecipientId;
objNameHere.AnchorXOffset = objDateHere.AnchorXOffset;
objNameHere.AnchorYOffset = objDateHere.AnchorYOffset;
objNameHere.AnchorUnits = objDateHere.AnchorUnits;
objNameHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objNameHere.Value = objDateHere.Value;
objNameHere.AnchorMatchWholeWord = "true";
lstSalesNameHere.Add(objNameHere);
}
}
}
objTab.SignHereTabs = lstSalesSignHere;
objTab.DateSignedTabs = lstSalesDateHere;
objTab.FullNameTabs = lstSalesNameHere;
objSigner.Tabs = objTab;
lstSigner.Add(objSigner);
}
}
return lstSigner;
}
我不知道这是一种最佳做法,但我的问题已经解决了。如果这不是一个好的做法,请提供建议。
更改库后
可悲的是,它没有在文档中的签名位置工作。我的文档 Signature 和 Signaturedate 中有两个字段,但是当我通过DocuSign网站签署文档时,这些字段放置在错误的位置。请参阅下面的文件。
因此,分配页码不是我的问题的解决方案。
答案 0 :(得分:2)
请在上面更新实际的代码更改,因为您正在显示的内容以及您在下面的“Say”内容似乎存在冲突。
看起来你错过了“TabId”又名“Tab Item”
"name": "sample string 1",
"tabLabel": "sample string 2",
"scaleValue": 3.1,
"optional": "sample string 4",
"documentId": "sample string 5",
"recipientId": "sample string 6",
"pageNumber": "sample string 7",
"xPosition": "sample string 8",
"yPosition": "sample string 9",
"anchorString": "sample string 10",
"anchorXOffset": "sample string 11",
"anchorYOffset": "sample string 12",
"anchorUnits": "sample string 13",
"anchorIgnoreIfNotPresent": "sample string 14",
"tabId": "sample string 15",
"conditionalParentLabel": "sample string 16",
"conditionalParentValue": "sample string 17"
https://www.docusign.net/restapi/help
我真的建议使用PostMan客户端和/或SoapUI验证您是否可以进行api呼叫,尤其是在开始时。通过这种方式,您可以看到返回的实际错误,因为它会更多地说明响应中出现的常见错误。 PostMan或SoapUI将成功发出实际的API调用(一旦您通过prod API认证,演示或Prod),向您显示实际响应,而不必担心编码拼写错误,对象属性或调试日志记录以查看实际返回的内容。
这使您可以在使用SDK时学习DocuSign API。你在Stack Overflow上找到了正确的帮助。
我有几个链接供您开始使用:
DocuSign开发人员中心,您可能在其中找到了PHP SDK https://developers.docusign.com/esign-rest-api/sdk-tools
链接获取有关PostMan的信息(旧版本,您可以获取最新版本 - 也就是Orange Rocket Man徽标vs蓝色世界,适用于Chrome或Mac Standalone - https://blog.grigsbyconsultingllc.com/postman-rest-client-a-google-chrome-app/
StackOverflow上的X-DocuSign认证标题Q&amp; A如何将标题X-DocuSign-Authentication用于REST和SOAP?
我首先喜欢DocuSign API资源管理器的概念,可悲的是它不会对prod起作用,所以当你从demo转移到prod时你仍然需要使用别的东西。
正如上面提到的“Amit K Bist”,您可以捕获发布PHP的确切JSON请求通过本DocuSign支持文章https://support.docusign.com/guides/ndse-user-guide-api-request-logging
中说明的步骤进行API调用最好的运气,享受您的DocuSign API之旅!