考虑下面的代码..如何传递到对象网络服务和消费该web服务
[Serializable]
public class Student
{
private string studentName;
private double gpa;
public Student()
{
}
public string StudentName
{
get{return this.studentName;}
set { this.studentName = value; }
}
public double GPA
{
get { return this.gpa; }
set { this.gpa = value; }
}
}
私人的ArrayList studentList =新的ArrayList();
[WebMethod]
public void AddStudent(Student student)
{
studentList.Add(student);
}
[WebMethod]
public ArrayList GetStudent()
{
return studentList;
}
我想使用简单的C#客户端表单应用程序使用该Web服务。 我无法使用以下代码段获取学生列表。
MyServiceRef.Student student = new Consuming_WS.MyServiceRef.Student();
MyServiceRef.Service1SoapClient client = new Consuming_WS.MyServiceRef.Service1SoapClient();
任何想法.. ??
预先感谢!
,能得到任何的异常/错误?您没有调用Web服务的GetStudent()方法。如果我们从Web服务返回C#ArrayList,我们是否可以真正从其他平台的客户端使用相同的ArrayList?说Java客户端? – Shekhar 2010-09-20 09:15:11
是的,我知道..但事情是我不能指定这样的东西.. ArrayList studentList = new ArrayList(); studentList = client.GetStudent();此代码段不起作用!任何想法..? – smartcode 2010-09-20 10:34:35