如何使用JavaScript获取.net Web服务?

时间:2012-02-28 11:38:14

标签: javascript .net

我有以下代码,它只适用于IE6:

if(document.getElementById("IsOnline").value == 'True')
                {
                    var mailBox = document.getElementById('CurrentMailBox').value;

                    var callObj = service.createCallOptions();
                    callObj.async = false;
                    callObj.params = new Array();
                    callObj.params.messageID = pmid;
                    callObj.params.mailBoxID = mailBox;
                    callObj.funcName = "GetPrivateMessageDetail";

                    var xml = service.svcIOra.callService(callObj);

                    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc.loadXML(xml.value);

                    toUserNames = getNodeValue(xmlDoc, "s_id_to_list");

                    fromUserNames = getNodeValue(xmlDoc, "s_id_from_list");
                    msgAttachment = getNodeValue(xmlDoc, "attachment_name");
                    attach_id = getNodeValue(xmlDoc, "attach_id");
                    msgBody = getNodeValue(xmlDoc, "msg_text");

                    //check to see if private message is invite message
                    var cfid = getNodeValue(xmlDoc, "confToJoin");
                    document.getElementById('ConferenceToJoin').value = cfid;

                    document.getElementById('JoinButton').style.display = (cfid!='') ? "inline" : "none";
                    document.getElementById('RejectButton').style.display = (cfid!='') ? "inline" : "none";
                }

如何在现代浏览器中完成这项工作?

任何帮助都会很棒。

谢谢,

1 个答案:

答案 0 :(得分:0)

查看以下内容或尝试Google“通过javascript调用Web服务”

http://www.codeproject.com/Articles/14610/Calling-Web-Services-from-HTML-Pages-using-JavaScr