访问webmethod时,Asp.Net Web服务的返回类型XmlDocument更改为XmlNode [英] Return type XmlDocument of an Asp.Net webservice changes to XmlNode when accessing the webmethod

查看:61
本文介绍了访问webmethod时,Asp.Net Web服务的返回类型XmlDocument更改为XmlNode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Webservice中有一个WebMethod,它返回一个XmlDocument。当我执行它并提供必要的参数时,Webserive工作正常。



我创建了一个代理到另一个application.proxy中的这个服务创建得很好。



现在的问题是,当我尝试从该服务访问方法时它获得所有来自服务的方法,但方法的返回类型显示为XmlNode而不是XmlDocument。



我们举个例子说:



Service.asmx

------------

I have a WebMethod in Webservice which is returning an XmlDocument.The Webserive works fine when i am executing it and providing the necessary parameters.

I have created a proxy to this serivce in another application.proxy is created well and good.

Now the problem is,when i try to access the methods from that serivce its getting all the methods from the service but the return type of the method is showing as XmlNode instead of XmlDocument.

Let us say for example:

Service.asmx
------------

public class DataService : System.Web.Services.WebService
{
    [WebMethod]
    public XmlDocument GetData(int ID)
    {

    }
}





现在我有一个Windows应用程序,我使用这项服务。



通过代理服务器创建一个对象。





Now i have one windows application which is using this service.

Created an object to the serive through proxy.

DRService.DataService  drService = new DRService.DataService();





现在我正在尝试访问服务方法。





Now i am trying to access the service methods.

drService.GetData(1)





上述方法调用的返回类型应为XmlDocument,但它返回XmlNode作为返回类型。



任何想法如何解决这个问题?



The return type of the above method call should be XmlDocument but it is returning XmlNode as return type.

Any idea how to solve this?

推荐答案

我认为这是你尝试时的默认行为将XmlDocument作为参数或返回值传递。而且大多数情况下你做不了多少。



你需要适当地修改消费者。请参考 http://support.microsoft.com/kb/330600 [ ^ ]



希望有所帮助

Milind
I think that is the default behavior when you try to pass XmlDocument as either parameter or as return value. And mostly you can''t do much.

You need to modify the consumer appropriately. Please refer http://support.microsoft.com/kb/330600[^]

Hope that helps
Milind


这篇关于访问webmethod时,Asp.Net Web服务的返回类型XmlDocument更改为XmlNode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆