DocuSign SoapAPI Sample doesn't work

2019-07-17 20:32发布

I'm just getting started with the DocuSign SOAP API, and I'm using the examples from their developer site as well as the GitHub site. While the two bits of code don't quite match, neither seems to work. I keep getting a System.ServiceModel.FaultException with the message, "Security requirements are not satisfied because the security header is not present in the incoming message."

I'm using a Service Reference with VS2012 to proxy the service https://demo.docusign.net/api/3.0/dsapi.asmx, and I have verified that my account works by using the online REST API explorer to obtain login information for my demo account.

Anyone run into this or have any suggestions?

3条回答
爷、活的狠高调
2楼-- · 2019-07-17 21:22

I found that I had to create a Service Reference (and not a Web Reference) pointed to https://demo.docusign.net/api/3.0/dsapi.asmx (and not https://demo.docusign.net/api/3.0/api.asmx as the sample at http://www.docusign.com/p/APIGuide/Content/DocuSignService%20API%20Overview/Code%20Samples.htm suggests).

I also had to make sure that I added the "X-DocuSign-Authentication" to the request headers by using a version of the sample code here http://www.docusign.com/p/APIGuide/APIGuide.htm#Introduction+Changes/Using DocuSign WSDLs in the Net Environment.htm%3FTocPath%3DUsing%20DocuSign%20WSDLs%7C___1

查看更多
何必那么认真
3楼-- · 2019-07-17 21:29

There are two way to pass member credentials using DocuSign's SOAP API:

  1. SOAP Header via WS-Security UsernameToken
  2. HTTP Header via a custom field “X-DocuSign-Authentication”

The DocuSign SOAP API has two different end points where everything is identical except for authentation: API.asmx and DSAPI.asmx. The API.asmx end point requires the WS-Security UsernameToken in the SOAP header authentication. The DSAPI.asmx and AccountManagement.asmx end points require the HTTP Header authentication method.

See DocuSign's SOAP documentation for more info: http://www.docusign.com/developer-center/documentation

查看更多
再贱就再见
4楼-- · 2019-07-17 21:38

I was getting the same error message until I changed the binding element in my web.config to match this:

<binding name="APIServiceSoap" allowCookies="true" maxReceivedMessageSize="50000000">
            <security mode="TransportWithMessageCredential" />
</binding>

A Github DocuSign SDK that was a valuable resource for me: https://github.com/docusign/DocuSign-eSignature-SDK

Also, as in the Github link above, I am using 2 Service References (CredentialAPI and DocuSignAPI).

查看更多
登录 后发表回答