问题描述
合约def是
[OperationContract]
DataSet myfunc(string a,params object [] args) ;
但是代理是由添加服务ref向导生成的
public System.Data.DataSet myfunc(string a,object [] args){
return base.Channel.GetDataSet(a,args)
}
两个都是.net 4.0项目
我可以更改代理,但更新将丢失更新
不确定你的问题是什么,但我猜你会看到问题,因为你使用 params
。 >
WSDL不处理这样的可选参数。
这是你在得到什么?
如果是这样,那么你最好的选择就是做代理生成的代码。传递一个对象数组(虽然你可能会遇到麻烦,试图传递任何旧的对象,因为有些将不是可序列化或可互操作)。
我不是真的确定你尝试使用可选参数,所以我不能告诉你到底该做什么。
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
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.
这篇关于wcf服务与params的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!