【发布时间】:2009-10-24 16:50:16
【问题描述】:
这可能很容易,但我在这里尝试做的是,我试图将客户对象传递给 Web 服务方法。 Customer 类在 Entity 命名空间上,它是可序列化的,我正在添加对调用 Web 服务并传递 Entity.Customer 对象的 ASP.NET 应用程序以及接受 Enity.Customer 对象的 WebService 的引用。
网络服务方法
[WebMethod]
public void AddCustomer(Entity.Customer c)
{}
ASP.NET 应用程序
Entity.Customer c = new Entity.Customer;
webservice.AddCustomer(c);
错误
'TestApplication.localhost.Service1.AddCustomer(TestApplication.localhost.Customer)' 的最佳重载方法匹配有一些无效参数
我尝试更改 Web 服务以接受对象,然后将该对象转换为 Customer.Entity,应用程序编译但我收到 XML 生成错误。
【问题讨论】:
-
您可以按 F12 转到生成的 AddCustomer 方法的定义并在此处粘贴声明吗?
标签: c# asp.net web-services