开发者

Proxy class changes the order of parametrs, put out param as first one

I have a WCF service that exposes a method with following signature

bool MyMethod(string MyParam1, string MyParam2, out string MyParam3)

But when I add a service reference, the proxy class changes order of parameters as follows

bool MyMethod(out string MyParam3, string MyParam1, string MyParam2)

It puts out param as first 开发者_如何学JAVAparameters. Any idea why it does this or could it be that I am doing something wrong?


Nothing is wrong, the proxy will be able to consume the service just as well - the message from the client to the server doesn't contain the out parameter, so the order of MyParam1 and MyParam2 is the expected; in the output message (response from the server), the out parameter is the only one in the body (apart from the return value).

The reference puts the out parameters first because the metadata (WSDL) only contains parameters for each message (input / output), not for the operation itself, so "add service reference" has to "guess" where the parameter would be - and having it as the first parameter in the operation is as good a guess as any other position.

Update: This no longer occurs when using .Net 4.5 on the client-side. The parameter order is maintained.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜