Я хочу добавить атрибут xml в мой ответ SOAP.
С учетом следующего кода:
using System.Collections.Generic; [assembly: System.Runtime.Serialization.ContractNamespaceAttribute("http://www.opengis.net/ows/2.0", ClrNamespace = "MyNameSpace.OWS")] namespace MyNameSpace.OWS { public class ExceptionReport { public List<OWS.Exception> Exceptions; public static string version = "1.0.0"; public ExceptionReport() { Exceptions = new List<OWS.Exception>(); } } public class Exception { public string ExceptionText; public string exceptionCode; public Exception() {} } }
Что мне нужно добавить к приведенному выше коду, чтобы следующий ответ гласил:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> ... <ExceptionReport xmlns="http://www.opengis.net/ows/2.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0"> ... </s:Body> </s:Envelope>
С учетом этого ( обратите внимание на отсутствие атрибута версии для элемента ExceptionReport ):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> ... <ExceptionReport xmlns="http://www.opengis.net/ows/2.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> ... </s:Body> </s:Envelope>