protected
void Page_Load(
object sender, EventArgs e)
{
object user = WebServiceHelper.InvokeWebService(
"
http://localhost/Service.asmx
",
"
Service
",
"
GetObject
",
null);
PrintData(user);
object lst = WebServiceHelper.InvokeWebService(
"
http://localhost/Service.asmx
",
"
Service
",
"
GetList
",
null);
Type Tp = lst.GetType();
if (Tp.IsArray)
{
object[] users = lst
as
object[];
for (
int i =
0; i < users.Length; i++)
{
PrintData(users);
}
}
else
{
PrintData(lst);
}
}
public
void PrintData(
object o)
{
Type Tp = o.GetType();
FieldInfo[] fields = Tp.GetFields();
Response.Write(
"
Fields:<br/>
");
for (
int i =
0; i < fields.Length; ++i)
{
FieldInfo filed = fields.GetValue(i)
as FieldInfo;
string str = String.Format(
"
Field Name:{0}/tField Value:{1}
", filed.Name, filed.GetValue(o));
Response.Write(str +
"
<br/>
");
}
Response.Write(
"
<br/>
");
}