I'm currently adding a new end point to an existing WCF service to receive web-hook notifications from DocuSign.
The method is expecting a single parameter of type DocuSignEnvelopeInformation which is a class defined in the DocuSign API which I have added as a service reference.
The XML request from DocuSign is using the namespace "http://www.docusign.net/API/3.0".
The implementation is very simple.
Interface:
[ServiceContract(Namespace = "http://www.docusign.net/API/3.0")]
public interface IDocuSignEventListener
{
[OperationContract]
[XmlSerializerFormat]
string DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation);
}
Controller:
[ServiceBehavior(Namespace = "http://www.docusign.net/API/3.0")]
public class DocuSignEventService : IDocuSignEventListener
{
[OperationBehavior]
public string DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation)
{
// process the notification
return DocuSignEnvelopeInformation.EnvelopeStatus.EnvelopeID;
}
}
When I run the service and visit the help page for the end point I see the following as the expected request:
As you can see the namespace attribute is not on the root node.
However DocuSign are sending the following XML with the namespace is on the root node:
The service is returning a 400 error for this request with the following exception:
Unable to deserialize XML body with root name 'DocuSignEnvelopeInformation'
and root namespace 'http://www.docusign.net/API/3.0' (for operation
'DocuSignConnectUpdate' and contract ('IDocuSignEventListener', 'http://www.docusign.net/API/3.0'))
using XmlSerializer. Ensure that the type corresponding to the XML is added to the known types collection
of the service.
If I manually edit the request body and move the namespace to the EnvelopeStatus node it all works perfectly, but obviously I can't control the format of the request in production.
I can't figure out why the service is expecting the namespace declaration on the inner node, particularly considering the DocuSignEnvelopeInformation object is referenced directly from the the DocuSign API.
Any guidance is greatly appreciated.

