Creating a DocuSign HTTP Header Authentication: Instructions for .NET Programmers
A few months ago we published a post on how to get started with DocuSign HTTP header authentication in Java. The below offers the same type of step-by-step guide for .NET programmers.
If you haven’t already done so, make sure to sign up for a free developer account from the DocuSign dev center (www.docusign.com/devcenter). After having gone through the process to get an integrator key, you will have access to the DocuSign API .
Let’s start with a simple .NET 4.0 + Visual Studio 2010 environment.
1) In the Solution Explorer right click on the project and select "Add Service Reference…."
2) In the address type in: https://demo.docusign.net/api/3.0/dsapi.asmx
3) In the namespace pick whatever namespace you prefer such as "DocuSign" and press OK.
In the code where you are going to make a call to DocuSign you will need to add an HTTP header. Here is an example of how such a call:
String auth = "<DocuSignCredentials><Username>" + userName
+ "</Username><Password>" + password
+ "</Password><IntegratorKey>" + integratorKey
+ "</IntegratorKey></DocuSignCredentials>";
DSAPIServiceSoapClient client = new DSAPIServiceSoapClient();
using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(client.InnerChannel))
{
HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
EnvelopeStatus status = client.RequestStatusEx("D3151108-FC4C-4D1A-A168-86E5233AACDB");
Console.Out.WriteLine("Subject: " + status.Subject);
}
And that is all: it’s very easy to get going.

