考慮下面的代碼..如何傳遞到對象網絡服務和消費該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