O
owais
I have problem in Web Reference of Xml webservice. I have webservice service1.asmx which has one [WebMethod]public XmlDocument HelloWorld()().
The WebService compiled and runs in browser well. But when I add the web reference of 'service1.asmx' in windows application and call the method HelloWorld and assigning the returning object to XmlDocument i.e.
XmlDocument xd = service1.HelloWorld();
it gives me error on compile time
"C:\WindowsApplication2\Form1.cs(91): Cannot implicitly convert type 'System.Xml.XmlNode' to 'System.Xml.XmlDocument'"
The tool generates the reference signature of 'Helloworld' method is shown below
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Xml.XmlNode HelloWorld() {
object[] results = this.Invoke("HelloWorld", new object[0]);
return ((System.Xml.XmlNode)(results[0]));
}
Please let me know why it will not generate the right datatype.
Thanks
The WebService compiled and runs in browser well. But when I add the web reference of 'service1.asmx' in windows application and call the method HelloWorld and assigning the returning object to XmlDocument i.e.
XmlDocument xd = service1.HelloWorld();
it gives me error on compile time
"C:\WindowsApplication2\Form1.cs(91): Cannot implicitly convert type 'System.Xml.XmlNode' to 'System.Xml.XmlDocument'"
The tool generates the reference signature of 'Helloworld' method is shown below
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Xml.XmlNode HelloWorld() {
object[] results = this.Invoke("HelloWorld", new object[0]);
return ((System.Xml.XmlNode)(results[0]));
}
Please let me know why it will not generate the right datatype.
Thanks