如何调用网络服务方法 [英] how to call web service methods
本文介绍了如何调用网络服务方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
StudentWebService.StudentWebService mStudentWS = new StudentWebService.StudentWebService();
if (mStudentWS.save(mStudentInfo, mSubjectInfoList))
{
hidmitvalue.Value = Convert.ToString(mStudentInfo.SysKey);
butNew.Visible = true;
butUpdate.Visible = true;
butDelete.Visible = true;
butSave.Visible = false;
Common.ShowMessage("Save Successfully", this.Page);
result = true;
}
编译此代码时,错误显示:
when compile this code, Error show:
Error 1 No overload for method ''save'' takes 0 arguments<br />
Error 2 The best overloaded method match for ''StudentWebService.StudentWebService.save(StudentWebService.StudentInfo, StudentWebService.SubjectInfo[])'' has some invalid arguments<br />
Error 3 Argument 1: cannot convert from ''Student.Info.StudentInfo'' to ''StudentWebService.StudentInfo''<br />
Error 4 Argument 2: cannot convert from ''System.Collections.Generic.List<Student.Info.SubjectInfo>'' to ''StudentWebService.SubjectInfo[]''
请给我有关此错误的建议
pls give me suggestions for this errors
推荐答案
消息很清楚,您传递给save方法的参数有问题.我想您正在尝试将List<>
作为第二个参数传递,同时该方法期望使用SubjectInfo
的数组.
尝试以这种方式称呼它:
Message is clear, the params you are passing to the save methods have something wrong. I suppose that you are trying to pass anList<>
as a second parameter, meanwhile the method is expecting the array ofSubjectInfo
.
Try to call it in this way:
if (mStudentWS.save(mStudentInfo, mSubjectInfoList.ToArray()))
干杯!
Cheers!
这篇关于如何调用网络服务方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文