I'm trying to exclude the result element being returned from my SOAP call but I cant seem to get it excluded. I then set up this simple call which returns xml data from a file. I need the result element removed as it wont validate against the schema. I've tried adding the SoapParameterStyle.Bare but i still get the node
[WebMethod]
[SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElement(IsNullable = true)]
public XmlDocument TestMethod(XmlDocument p_xmlDoc)
{
XmlDocument xmldoc = new XmlDocument();
string sResponsePath = ConfigurationManager.AppSettings["FileDirectory"] + ConfigurationManager.AppSettings["GetOrders"];
string sXMLResponse = File.ReadAllText(sResponsePath);
xmldoc.LoadXml(sXMLResponse);
return xmldoc;
}
Here is the first few nodes that would be returned from that SOAP call and as you can see the TestMethodResult is returned under the Body element:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TestMethodResult xmlns="http://tempuri.org/">
<ns0:TestMethodResponse xmlns:ns0="http://eibdigital.co.uk/citb/EibOrderInterface">
<ns0:TestMethodResult>