如何將我的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 –