带参数的 WCF 服务
合同定义是,
[OperationContract]
DataSet myfunc(string a, params object[] args);
但是代理是由添加服务引用向导生成的,
public System.Data.DataSet myfunc(string a, object[] args) {
return base.Channel.GetDataSet(a, args);
}
什么给出了?两者都是 .net 4.0 项目
我可以更改代理,但更改将在更新时丢失
the contract def is
[OperationContract]
DataSet myfunc(string a, params object[] args);
but the proxy is generated like so by the add service ref wizard
public System.Data.DataSet myfunc(string a, object[] args) {
return base.Channel.GetDataSet(a, args);
}
what gives ? both are .net 4.0 projects
I can change the proxy but the changes will be lost on update
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您的问题是什么,但我猜您因为在那里使用了
params
而遇到了问题。WSDL 不处理这样的可选参数。
这就是你的意思吗?
如果是这种情况,那么您最好的选择可能是执行代理生成的代码正在执行的操作。传递对象数组(尽管尝试传递任何旧对象可能会遇到麻烦,因为有些对象不可序列化或可互操作)。
我不太确定你想用可选参数做什么,所以我不能告诉你到底该怎么做。
Not sure what your question is, but I'm guessing you're seeing problems because of your use of
params
there.WSDL doesn't deal with optional parameters like that.
Is that what you're getting at?
If that's the case, then your best bet may be to do what the proxy generated code is doing instead. Pass an array of objects (though you may run into trouble trying to pass just any old object since some won't be serializable or interoperable).
I'm not really sure what you're trying to do with the optional parameters though, so I can't tell you exactly what to do instead.