DocuSign API Windows Service "Fail to resolve SendOnBehalfOf user"



我正在尝试创建一个Windows服务,以便使用DocuSign API外出下载文档和信封信息。我遇到了一个错误,我不知道如何解决。

写入错误日志的消息显示"System.ServiceModel.FaultException:此用户缺少足够的权限。无法解析SendOnBehalfOf用户"。

我检查了DocuSign控制台,在DocuSignneneneba API部分的Account-Wide Rights、Send On Behalf Of Rights、Sequential Signing都已检查。

我有点困惑,为什么它试图解析SendOnBehalfOf用户,因为我没有尝试发送任何内容。

这是代码的相关部分:

string auth = "<DocuSignCredentials><Username>" + DSuserName
 + "</Username><Password>" + password
 + "</Password><IntegratorKey>" + key
 + "</IntegratorKey></DocuSignCredentials>";
DocuSignAPI.DSAPIServiceSoapClient client = new DSAPIServiceSoapClient();
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
  HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] =   httpRequestProperty;

Envelope test = new Envelope();
test = client.RequestEnvelope(envelopeID, false);
string envelopeData = envelopeID + "|" + test.CustomFields[0].Value.ToString();
envelopeData = envelopeData.Replace("|", ",");
EnvelopePDF envPDF = new EnvelopePDF();
envPDF = client.RequestPDFWithCert(envelopeID, false);
}

这是我从追踪中得到的:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>0</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2013-11-22T19:07:59.3523309Z" />
<Source Name="System.ServiceModel.MessageLogging" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="DocuSignService" ProcessID="8620" ThreadID="7" />
<Channel />
<Computer>OPSITLAP03</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<MessageLogTraceRecord Time="2013-11-22T14:07:59.3523309-05:00" Source="TransportSend" Type="System.ServiceModel.Dispatcher.OperationFormatter+OperationFormatterMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<Addressing>
<Action>http://www.docusign.net/API/3.0/RequestEnvelope</Action>
<To>https://www.docusign.net/api/3.0/dsapi.asmx</To>
</Addressing>
<HttpRequest>
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<X-DocuSign-Authentication><DocuSignCredentials><Username>"[IntegratorKey]UserID"</Username><Password>"Password"</Password><IntegratorKey>"IntegratorKey"</IntegratorKey></DocuSignCredentials></X-DocuSign-Authentication>
</WebHeaders>
</HttpRequest>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RequestEnvelope xmlns="http://www.docusign.net/API/3.0">
<EnvelopeID>50be5ed0-ece2-44ea-bfbd-53c02e81e916</EnvelopeID>
<IncludeDocumentBytes>false</IncludeDocumentBytes>
</RequestEnvelope>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>

您的跟踪将X-DocuSign-Authentication标头的值显示为:

<DocuSignCredentials><Username>"[IntegratorKey]UserID"</Username><Password>"Password"</Password><IntegratorKey>"IntegratorKey"</IntegratorKey></DocuSignCredentials>

不确定为什么您为用户名使用的值似乎以"[IntegratorKey]"开头。我建议您尝试只使用与用户登录凭据关联的电子邮件地址,而不要以"[IntegratorKey]"开头。例如:

<DocuSignCredentials><Username>johndoe@example.com</Username><Password>johnspassword</Password><IntegratorKey>TEST-eae5f282-k7c2-59b2-b293-1c4cf55c76def</IntegratorKey></DocuSignCredentials>

使用RequestEnvelope api调用时,信封必须归api用户所有。由于它似乎不是你试图使用SOBO功能,这很可能会导致你的问题。

最新更新