I am using ASP.NET MVC 4 to write a Web API application. I have an API method that returns a digitally signed XmlDocument object. From the client I am requesting the response in JSON format but the problem I am having is the namespace attribute on the Signature element is being removed during the serialisation.Controller action that returns XmlDocument:\[code\][HttpGet] public XmlDocument GetSignedXml(){ return service.GetSignedXml(); }\[/code\]Client code that calls the API method\[code\]HttpClient client = new HttpClient { BaseAddress = new Uri("http://server/") };client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));HttpResponseMessage response = client.GetAsync("api/GetSignedXml").Result;if (response.IsSuccessStatusCode){ XmlDocument xmlDocument = response.Content.ReadAsAsync<XmlDocument>().Result; service.VerifyXml(xmlDocument);}\[/code\]Here is the XML that is generated server-side before it is returned:\[code\]<?xml version="1.0" encoding="utf-16"?><ArrayOfAvailableModule xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AvailableModule> <Module>NominalLedger</Module> <UserCount>1</UserCount> <ExpiryDate xsi:nil="true" /> </AvailableModule> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI=""> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>P+m5+ZBFc1HX0hAorlqtwl3zdgw=</DigestValue> </Reference> </SignedInfo> <SignatureValue>IgG+yglFSVjj5r0VyabLGasgTPwfOf+cISmL+WRpb4L5DCUaV20ly8S5l3XwNflhzF31w2Smk1nlF6RBTgCNSPNtlheU+ALceB61Wf5awXVpxT7iBQfoEAJHkFtUEUkg1U/bh/WvE/dOzJ5jKPtCzoYfJ9X/ioj0V/oXUqEmlNI=</SignatureValue></Signature>\[/code\]Here is the XML that is received client-side\[code\]<?xml version="1.0" encoding="utf-16"?> <ArrayOfAvailableModule xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AvailableModule> <Module>NominalLedger</Module> <UserCount>1</UserCount> <ExpiryDate xsi:nil="true" /> </AvailableModule> <Signature> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI=""> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>P+m5+ZBFc1HX0hAorlqtwl3zdgw=</DigestValue> </Reference> </SignedInfo> <SignatureValue>IgG+yglFSVjj5r0VyabLGasgTPwfOf+cISmL+WRpb4L5DCUaV20ly8S5l3XwNflhzF31w2Smk1nlF6RBTgCNSPNtlheU+ALceB61Wf5awXVpxT7iBQfoEAJHkFtUEUkg1U/bh/WvE/dOzJ5jKPtCzoYfJ9X/ioj0V/oXUqEmlNI=</SignatureValue> </Signature></ArrayOfAvailableModule>\[/code\]The only difference between the two pieces of XML is that the one that is received at the client is missing the namespace attribute on the Signature element. The conclusion I have come to is that the JSON serialisation/deserialisation process is removing the namespace but how I can stop this as the verification process on the client is failing because the XML has been changed.