我想看到下面的格式作为我的 web 服务的输出,但它返回为空,你介意帮我弄清楚吗?
我正在使用 asp.net2
我想收到如下输出:
<LIST OF CUSTOMER>
<CustomerData>
<V_CUST_CODE value="c1"/>
<V_CUST_NAME value="Customer 1"/>
</CustomerData>
<CustomerData>
<V_CUST_CODE value="c2"/>
<V_CUST_NAME value="Customer 2"/>
</CustomerData>
<CustomerData>
<V_CUST_CODE value="c2"/>
<V_CUST_NAME value="Customer 2"/>
</CustomerData>
<LIST OF CUSTOMER/>
我目前的输出:
<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfCustomerData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://123.23.45.34/sms/" />
我的网络服务
[WebMethod]
public List<CustomerData> getFMSCustomerName()
{
string[] cols = {"V_CUST_CODE", "V_CUST_NAME"};
ArrayList CustomerList = (ArrayList)db.Select(cols, "table1", "", "order by V_CUST_NAME");
List<CustomerData> cd = new List<CustomerData>();
foreach(DataRow dr in CustomerList)
cd.Add(new CustomerData(dr["V_CUST_CODE"].ToString(), dr["V_CUST_NAME"].ToString()));
return cd;
}
public class CustomerData
{
private string _V_CUST_CODE;
private string _V_CUST_NAME;
public String V_CUST_CODE
{
get
{
return this._V_CUST_CODE;
}
set
{
this._V_CUST_CODE = value;
}
}
public String V_CUST_NAME
{
get
{
return this._V_CUST_NAME;
}
set
{
this._V_CUST_NAME = value;
}
}
public CustomerData(String V_CUST_CODE, String V_CUST_NAME)
{
this.V_CUST_CODE = V_CUST_CODE;
this.V_CUST_NAME = V_CUST_NAME;
}
public CustomerData() { }
}