I ran into a problem, I canβt decide why I ask you to help me! I am working with a WebService, and I am trying to return an XmlDocument from a WebService method called GetSystemDocument, which looks like this:
[WebMethod(Description = "blabla")] public XmlDocument GetSystemDocument(string DocumentName) { return new XmlDocument(); }
In a project where I refer to this web service. Visual Studio tells me that it cannot implicitly convert the type "System.Xml.XmlNode" to "System.Xml.XmlDocument".
If I look into the Reference.cs file (generated by Visual Studio), the code looks like this:
/// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://doc.cexp.ca/GetSystemDocument", RequestNamespace="http://doc.cexp.ca", ResponseNamespace="http://doc.cexp.ca", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public System.Xml.XmlNode GetSystemDocument(string DocumentName) { object[] results = this.Invoke("GetSystemDocument", new object[] { DocumentName}); return ((System.Xml.XmlNode)(results[0])); }
There is a problem. Instead of XmlNode, we should see XmlDocument, if I edit it manually, it builds and everything works fine.
I tried resetting IIS, updating the link, rebuilding the web service. Does anyone have a solution?
Here is a similar question that does not answer.
thanks a lot
David source share