Web服务方法调用问题 [英] web service method calling issue

查看:108
本文介绍了Web服务方法调用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

当我从javascript调用Web服务方法时,发生了异常.

sys.net.webservicefailed异常和
system.invalid operation exception ...身份验证失败.

这是我调用Web服务功能时收到的错误消息

有这个想法.帮帮我
*******************这是用于调用webservice的javasript.*********************** *****************



function SaveLocation() {
    alert("inside save location_______jscript");
    gettxtPatientID().value = PatientID;
    MedVisit_Web.GMapWebService.SavePatientLocation(PatientID, Latitude, Longitude, SaveLocationResult);
}



function SaveLocationResult(result, userContext)
{
    hovermarker.closeInfoWindow();

}





*****************这是Web服务方法**************************** ***********

[WebMethod(EnableSession = true)]
        public bool SavePatientLocation(string PatientID, string Lattitude, string Longitude)
        {
            if (PatientID.Length > 0)
            {
                GMapPoints point = new GMapPoints();
                point.DeletePatientPoint(Convert.ToInt32(PatientID));
                GMapPatientDetails patientpoints = new GMapPatientDetails();
                patientpoints.PatientID = Convert.ToInt32(PatientID);
                patientpoints.Latitude = Lattitude;
                patientpoints.Longitude = Longitude;
                if (point.InsertPatientPoint(patientpoints))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

解决方案

您的方法有3种方法,而您传入​​了4种方法.通过使用pagemethod.method名称并添加一些
方法 ontimeout,onerror和print stackstrace看到那里是什么错误

 SavePatientLocation(PatientID,纬度,经度,SaveLocationResult,ontimeout,onerror); 



funtion ontimeout(error)<br />
{<br />
  alert(error);<br />
}<br />
function onerror(error,context)<br />
{<br />
  alert(error);<br />
}


Hi all,

when i call a web service method from javascript,an exception occured.

sys.net.webservicefailed exception and
system.invalid operation exception...... authentication failed.

this is the error message i have got when i called the web service fuction

have any idea about this.Help me
*******************this is the javasript for calling webservice.****************************************



function SaveLocation() {
    alert("inside save location_______jscript");
    gettxtPatientID().value = PatientID;
    MedVisit_Web.GMapWebService.SavePatientLocation(PatientID, Latitude, Longitude, SaveLocationResult);
}



function SaveLocationResult(result, userContext)
{
    hovermarker.closeInfoWindow();

}





*****************this is the webservice method***************************************

[WebMethod(EnableSession = true)]
        public bool SavePatientLocation(string PatientID, string Lattitude, string Longitude)
        {
            if (PatientID.Length > 0)
            {
                GMapPoints point = new GMapPoints();
                point.DeletePatientPoint(Convert.ToInt32(PatientID));
                GMapPatientDetails patientpoints = new GMapPatientDetails();
                patientpoints.PatientID = Convert.ToInt32(PatientID);
                patientpoints.Latitude = Lattitude;
                patientpoints.Longitude = Longitude;
                if (point.InsertPatientPoint(patientpoints))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

解决方案

Your method has three methods and you''re passing in four.


hey shefeekcm: call your method by using pagemethod.method name and add some
ontimeout,onerror and print stackstrace see there what is the error

SavePatientLocation(PatientID, Latitude, Longitude, SaveLocationResult,ontimeout,onerror);



funtion ontimeout(error)<br />
{<br />
  alert(error);<br />
}<br />
function onerror(error,context)<br />
{<br />
  alert(error);<br />
}


这篇关于Web服务方法调用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆