我正在将Web服务转换为WCF。在该服务中,Web方法正在返回WCF中不支持的xmldocument。 [英] I am converting a web service into WCF. In that service web methods are returning xmldocument which is not supported in WCF.

查看:93
本文介绍了我正在将Web服务转换为WCF。在该服务中,Web方法正在返回WCF中不支持的xmldocument。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建操作合同时,它正常工作,而消费则不支持。



我尝试过:



我只是删除web方法标签并用操作合同装饰代码,没有代码更改。我试图将XMLDocument更改为返回类型为XMLElement,但内部代码是为整个xmldocument返回而设计的。



请帮帮我。

解决方案

你可以使用

 XmlSerializerFormat 



 [OperationContract, XmlSerializerFormat] 
XmlDocument YourMethod();



您还可以重新编写代码以返回

 XElement 

代替


When i am creating Operation contracts it is working fine while consuming it is not supporting.

What I have tried:

I am simply remove the web method tag and decorate the code with operation contract there is no code change. I have tried to change the XMLDocument as return type to XMLElement but the inner code is designed for the whole xmldocument return.

Please do help me.

解决方案

You might use

XmlSerializerFormat


[OperationContract,XmlSerializerFormat]
XmlDocument YourMethod();


Also you could redesing the code to return

XElement

instead


这篇关于我正在将Web服务转换为WCF。在该服务中,Web方法正在返回WCF中不支持的xmldocument。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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