Problem in WebReference of WebService?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top