开发者

Can params keyword be expressed via WSDL definition

开发者 https://www.devze.com 2023-03-07 08:25 出处:网络
The application I am developing is exposing service metadata for a WCF service implementing following service contract:

The application I am developing is exposing service metadata for a WCF service implementing following service contract:

[ServiceContract]
public interface IService
{
    [OperationContract]
    object Execute( string action, params object[] args );
}

After adding service reference I noticed that there is no params keyword in the service contract and its i开发者_如何学JAVAmplementation in the generated Reference.cs file.

Is there params counterpart in WSDL definition?

Or is params something that is specific to C# and cannot be expressed via WSDL definition so service client generator does not know that params should be added during generation?


params is just syntactic sugar which allows you calling the method expecting array of objects without passing the prepared array. WCF doesn't know anything about this - it should just expect array of objects. Btw. passing array of object to service operation can leads to multiple problems because if you pass an custom object as parameter WCF may not know how to serialize the object.

0

精彩评论

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

关注公众号