如何将我的Web应用程序中的类“BL_Customer”的类对象'obj'传递给我的Webservice(ASMX)中的函数'Insert()',然后访问该类的属性在Webservice中的对象?我通过'添加WebReference'工具包含了我的远程web服务。我已经包括'使用WebRererence';'命名空间也。任何帮助将不胜感激。将类对象传递给WebService
这是我BL_Customer类业务层:
public class BL_Customer
{
public BL_Customer()
{
}
string c_Cust_Name = string.Empty;
string c_Mobile_no = string.Empty;
public string Cust_Name
{
get { return c_Cust_Name; }
set { c_Cust_Name = value; }
}
public string Mobile_no
{
get { return c_Mobile_no; }
set { c_Mobile_no = value; }
}
}
这是我的数据访问层:
public class DAL_Customer
{
public SqlConnection con = new SqlConnection();
WebReference.Service objWEB = new WebReference.Service(); //objWEB -> Webservice object
Connection c = new Connection();
public DAL_Customer()
{
}
public int Customer_Insert(BL_Customer obj)
{
---------
---------
return objWEB.Insert(obj); // Insert() is a function in my remote webservice
}
}
这是我的web服务:
public class Service : System.Web.Services.WebService
{
public Service() {
}
[WebMethod]
public string insert(**What should be here?**)
{
-----
-----
}
}
问候, 大卫
ASMX web服务或WCF? – Damith
@UnhandledException asmx –