What are these extra parameters in my ASMX Proxy Methods?

后端 未结 4 1325
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 05:29

If I add a web reference from a .NET 1.1 client to a WCF service, the proxy methods generated at the client contain an extra parameter ending with the suffix \'Specified\' f

相关标签:
4条回答
  • 2020-12-19 05:50

    You probably need t osay that your parameters are required

    [OperationContract] 
    string HelloWorld([RequiredDataParameter] string foo,
                      [RequiredDataParameter] int bar);
    
    0 讨论(0)
  • 2020-12-19 05:54

    This is due to a difference in the serialization mechanisms used in WCF and ASMX Web Services. To avoid extra params you must specify XmlSerializerFormat attribute on ServiceContract.

    for add read this: http://msmvps.com/blogs/windsor/archive/2008/05/17/calling-wcf-services-from-net-1-1.aspx

    0 讨论(0)
  • 2020-12-19 05:58

    .NET 1.1 Web services don't have a concept of null so WCF is generating these extra properties for you. fooSpecified = false means foo is really null.

    0 讨论(0)
  • 2020-12-19 06:04

    The issue is with parameters of a value type when they are permitted to be absent. .NET 1.1 has no way to specify this without the *specified parameters. They need to be set to true to indicate that the corresponding parameter is being sent.

    0 讨论(0)
提交回复
热议问题