我怎样才能防止外部参数结束返回参数在WCF Web服务? [英] How can I prevent an out-parameter to end up return parameter in a WCF web service?
问题描述
如果我的合同看起来如下:
If my contract looks as follows:
[OperationContract]
void DoSomething(int id, out string moreInfo);
这最终看起来像:
string DoSomething(int id);
当您导入Web服务引用。是有可能影响参数的顺序的自动转换?这已经是惊讶地发现在函数签名的开始所有输出参数,但是这仍然是可行的,但我们想空隙的方法来继续成为无效的方法。 ?或者这是一个SOAP的限制
when you import a web service reference. Is it possible to influence the auto-conversion of the order of the parameters? It was already surprising to find all out-parameters at the beginning of the function signature, but that was still workable, but we'd like void-methods to continue being void-methods. Or is this a SOAP limitation?
推荐答案
这似乎是基于一个WSDL限制:
的 http://social.msdn.microsoft.com /论坛/ EN-US / WCF /线程/ 48b5992f-f7bd-4b67-8299-514d1780fa9a
It appears to be based on a WSDL limitation: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/48b5992f-f7bd-4b67-8299-514d1780fa9a
WSDL不显示原来的方法签名;相反,它表明
输入参数为1组,输出参数作为另一个
组。
WSDL does not show the original method signature; instead, it shows the input parameters as a group and the output parameters as another group.
不能够返回值从输出参数单独限制是WSDL。但是,这将意味着一个void方法的局限性是svcutil.exe的我认为的一部分。没有理由为什么不能上SvcUtil工具不动第一输出返回值的开关,但是这将是在MS连接功能的要求。
The limitation of not being able to separate return values from out parameters is in the WSDL. But that would mean the limitation of a void method would be part of svcutil.exe I think. There's no reason why there can't be a switch on svcutil to not move the first output to a return value, but that would be a request for a feature on ms connect.
而不是无效的,你可以返回一个简单的状态int或布尔,如果你的问题是一致的,但我敢肯定,这不是一个完美的答案,如果你已经有几十种方法。
Rather than void, you could return a simple status int or bool if your issue is consistency, but I'm sure that's not a perfect answer if you already have dozens of methods.
这篇关于我怎样才能防止外部参数结束返回参数在WCF Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!