using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.IO;
using System.Xml.Serialization;
using System.Text;
using System.Collections.Generic;
/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService {
public WebService () {
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
//return "Hello World";
List<ccd> bb = new List<ccd>();
//ArrayList<
// ArrayList bb = new ArrayList();
for (int i = 0; i < 3; i++)
{
ccd ccd1 = new ccd();
ccd1.cc1 = i.ToString();
ccd1.cc2 = (i + 5).ToString();
// ccd1.cc3 = (i + 6).ToString();
ccd2 cccd2 = new ccd2();
cccd2.kk1 = (i + 7).ToString();
cccd2.kk2 = (i + 8).ToString();
ccd1.cc4 = cccd2;
bb.Add(ccd1);
}
//ccd t_item = new ccd();
//t_item.cc1 = "7754";
//t_item.cc2 = "爆米花机";
//MemoryStream ms = new MemoryStream();
//XmlSerializer xml = new XmlSerializer(t_item.GetType());
//xml.Serialize(ms, t_item);
MemoryStream ms = new MemoryStream();
XmlSerializer xml = new XmlSerializer(bb.GetType());
xml.Serialize(ms, bb);
//return bb;
return Encoding.UTF8.GetString(ms.ToArray()).Replace("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"","");
}
[WebMethod(Description = "求和的方法")]
public double addition(double i, double j)
{
return i + j;
}
}
public class ccd
{
public string cc1;
public string cc2;
//public string cc3;
public ccd2 cc4;
}
public class ccd2
{
public string kk1;
public string kk2;
}