我正在使用 DocuSign REST API 在 C# MVC 应用程序中集成协议签名。我已经获得了几乎所有按我想要的方式工作的功能,但是我在 DocuSign iframe 中完成签名后加载的页面遇到了一些问题。我在模板身份验证之外的项目中创建了一个视图,并将 XML“returnUrl”标记指向它。
它现在加载该页面,但是问题来自尝试传入多个参数。理想情况下,我想传入 3 个不同的字符串,但是当我尝试在 URL 中包含所有 3 个查询字符串参数时,XML 请求错误。一个它通过就好了。
当前代码不会出错并允许在将单个参数传递到签名后页面时完成签名过程:
string reqBody = "<recipientViewRequest xmlns=\"http://www.docusign.com/restapi\">" +
"<authenticationMethod>email</authenticationMethod>" +
"<email>" + model.TSM.Email + "</email>" + // NOTE: Use different email address if username provided in non-email format!
"<returnUrl>https://maaxspasportal.com/TerritorySalesManagement/AfterSigningLandingPage?contactName=" + model.ContactName.Replace(" ", "%20") + "</returnUrl>" + // username can be in email format or an actual ID string
"<clientUserId>1</clientUserId>" +
"<userName>" + model.TSM.Name + "</userName>" +
"</recipientViewRequest>";
使 XML 请求无效并返回错误的代码:
string contactName = model.ContactName.Replace(" ", "%20");
string companyName = model.CompanyName.Replace(" ", "%20");
string contactEmail = model.Dealer.Email.Replace(" ", "%20");
string reqBody = "<recipientViewRequest xmlns=\"http://www.docusign.com/restapi\">" +
"<authenticationMethod>email</authenticationMethod>" +
"<email>" + model.TSM.Email + "</email>" + // NOTE: Use different email address if username provided in non-email format!
"<returnUrl>https://maaxspasportal.com/TerritorySalesManagement/AfterSigningLandingPage?contactName=" + contactName + "&companyName=" + companyName + "&contactEmail=" + contactEmail + "</returnUrl>" + // username can be in email format or an actual ID string
"<clientUserId>1</clientUserId>" +
"<userName>" + model.TSM.Name + "</userName>" +
"</recipientViewRequest>";
这是我收到的错误:
<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><errorCode>INVALID_REQUEST_BODY</errorCode><message>The request body is missing or improperly formatted. An error occurred while parsing EntityName. Line 1, position 271.</message></errorDetails>
有没有人遇到过这个?有没有更好的方法将参数传递给我的“returnUrl”页面?谢谢你的帮助。