2
我有方法SOAP Web服务:无法发送对象SOAP Web服务
string startReaction(object reaction);
内部的方法,我这个对象转换为它的真正类型:
Reaction reactionObj = (Reaction)reaction;
...
我有相同的Reaction
表单项目中的窗口(窗口应该调用此ws)。在这里,我制作Reaction对象实例并填充数据并尝试发送到Web服务。
string data = webserviceReference1.startReaction(reaction);
我也曾尝试:
string data = webserviceReference1.startReaction(reaction as object);
,但没有。 然后,我尝试在“反应”类中添加此属性:
[XmlInclude(typeof(object))]
public class Reaction{...
但没有任何结果。 ,我得到的错误是:
There was an error generating the XML document. :: System.InvalidOperationException: The type Demo.Form1+Reaction was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
为什么'string startReaction(Reaction reaction); '? – 2012-03-20 11:44:55