此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【alisafan123】截止到2008-07-03 11:35:36的历史汇总数据(不包括此帖):
发帖的总数量:1                        发帖的总分数:130                      
结贴的总数量:0                        结贴的总分数:0                        
无满意结贴数:0                        无满意结贴分:0                        
未结的帖子数:1                        未结的总分数:130                      
结贴的百分比:0.00  %               结分的百分比:0.00  %                  
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html

解决方案 »

  1.   

    美女,我来支持下。servlet你先测试下你的这个调用servlet的方法是否有效。我怎么没见过这种方法。
      

  2.   


    public string webstring = ConfigurationManager.AppSettings["ImportWebReference.Import"].ToString() + "?WSDL";//websever引用地址
     service.useService("<%=webstring %>","MyMath");
     var str_province=service.MyMath.callService(OnComplete,"GetProgress");
      

  3.   

    关注 还没有用过js 调用web service
      

  4.   


     <div id="service">
        </div>
      

  5.   

    你写的这个实在是混乱 你可以找个现成的ajax对象  用它的方法来post你的servlet请求  
    或者最简单的办法就是使用dwr 你可以在javascript里直接调用的 你的service 方法 然后通过callback来得到返回结果
      

  6.   

    其实就这么2句话
    service.useService("http://localhost/Innovation/Service/Service.asmx?wsdl","GetMess");
    service.GetMess.callService(getdata() ,"GetMess");
      

  7.   

     style="BEHAVIOR:url(webservice.htc)" 
    用这个方法要加这个!
      

  8.   

    发表于:2008-07-03 12:35:2111楼 得分:0 
    style="BEHAVIOR:url(webservice.htc)" 
    用这个方法要加这个! 
    这个我在网上看好象要加什么的把.
      

  9.   

    看来我的水平不审很菜,service.useService("http://localhost/Innovation/Service/Service.asmx?wsdl","GetMess"); 
    service.GetMess.callService(getdata() ,"GetMess"); 
    看都没看过
      

  10.   

    如果用js调用webservice+xmlhttp的实现,要添加soap头!//test function with get method.
    function RequestByGet(data){ var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    //Webservice location.
    var URL="http://localhost:1323/WebSite6/Service.asmx/SayHelloTo?Name=Zach";
    xmlhttp.Open("GET",URL, false); 
    xmlhttp.SetRequestHeader ("Content-Type","text/xml; charset=utf-8"); 
    xmlhttp.SetRequestHeader ("SOAPAction","http://tempuri.org/SayHelloTo"); 
    xmlhttp.Send(data); 
    var result = xmlhttp.status; 
    //OK
    if(result==200) { 
    document.write(xmlhttp.responseText); 

    xmlhttp = null; 
    } //test function with post method
    function RequestByPost(value)
    {
    var data;
    data = '<?xml version="1.0" encoding="utf-8"?>'; 
    data = data + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'; 
    data = data + '<soap:Body>'; 
    data = data + '<SayHelloTo xmlns="http://tempuri.org/">'; 
    data = data + '<Name>'+value+'</Name>'; 
    data = data + '</SayHelloTo>'; 
    data = data + '</soap:Body>'; 
    data = data + '</soap:Envelope>'; var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    var URL="http://localhost:1323/WebSite6/Service.asmx";
    xmlhttp.Open("POST",URL, false); 
    xmlhttp.SetRequestHeader ("Content-Type","text/xml; charset=gb2312"); 
    xmlhttp.SetRequestHeader ("SOAPAction","http://tempuri.org/SayHelloTo"); 
    xmlhttp.Send(data); 
    document.write( xmlhttp.responseText); }
    本篇文章来源于 站长中国 转载请以链接形式注明出处 网址:http://www.zzchn.com/edu/20071117/68545.shtml
      

  11.   

    webservice.htc
    是微软出的htc组件!
      

  12.   

    放在文件里,最好跟你的页面一个文件夹!
    <div id="service" style="behavior: url(../webservice.htc)">
        </div>
      

  13.   


    JQuery 中的Ajax调用WebServices 的总结
      

  14.   

    发表于:2008-07-03 15:28:0318楼 得分:0 
    放在文件里,最好跟你的页面一个文件夹! 
    <div id="service" style="behavior: url(../webservice.htc)"> 
        </div> 
    能给我下个吗,我这不能下东西.汗死,大吓
      

  15.   

    csdnApi 调用示例 查询积分用 <html>
    <title>CSDN积分查询--清洁工2008版</title>
    <head>
        <hta:application id="sofa" icon="sofa.ico" />
    </head>
    <body>
    <div>
        用户名:<input type="text" id="TextUsername"/>
        密码:<input type="password" id="TextPassword"/>
        目标用户:<input type="text" id="TextDestuser" />
        <input type="button" value="开始查询" onclick="ButtonStartClick();" id="ButtonStart" />
    </div>
    <div style="width:100%; height:80%">
        <textarea id="TextareaLog" style="width:100%; height:100%"></textarea>
    </div>
    <script language="javascript" type="text/javascript">
    var ForAppending = 8; // 追加模式
    var ForReading = 1; // 读取模式
    var ForWriting = 2; // 写入模式var fso = new ActiveXObject("Scripting.FileSystemObject"); // 文件系统
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // http访问
    var textareaLog = document.getElementById("TextareaLog"); // 日志文本框
    var textUsername = document.getElementById("TextUsername"); // 用户名
    var textPassword = document.getElementById("TextPassword"); // 密码
    var textDestuser = document.getElementById("TextDestuser"); // 目标用户/// <summary>
    /// 将字符串追加到文本文件最后
    /// </summary>
    /// <param name="filename">文件名</param>
    /// <param name="text">所要追加的字符串</param>
    /// <returns>返回文本文件中的字符串</returns>
    function AppendFileText(filename, text)
    {
        var istream = fso.OpenTextFile(filename, ForAppending, true);
        if (!istream) return;
        try
        {
            istream.write(text);
            istream.Close();
        }
        catch (e)
        {
        }
    }/// <summary>
    /// 将字符串写到文本文件中
    /// </summary>
    /// <param name="filename">文件名</param>
    /// <param name="text">所要追加的字符串</param>
    /// <returns>返回文本文件中的字符串</returns>
    function WriteFileText(filename, text)
    {
        var istream = fso.OpenTextFile(filename, ForWriting, true);
        if (!istream) return;
        try
        {
            istream.write(text);
            istream.Close();
        }
        catch (e)
        {
        }
    }/// <summary>
    /// 添加日志
    /// </summary>
    /// <param name="text">日志文本</param>
    function AppendLog(text)
    {
        if (textareaLog) textareaLog.value += text;
        AppendFileText("log.txt", text);
    }/// <summary>
    /// 获得用户积分信息
    /// </summary>
    /// <param name="username">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="destuser">目标用户</param>
    /// <returns>返回构造的用户积分信息</returns>
    function GetUserProfile(username, password, destuser)
    {
        var contentText = 
    '<?xml version="1.0" encoding="utf-8"?>\n' +
    '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">\n' +
    '    <soap12:Body>\n' +
    '        <GetUserProfile xmlns="http://www.csdn.net/">\n' +
    '            <identity>\n' +
    '                <username>' + username + '</username>\n' +
    '                <password>' + password + '</password>\n' +
    '            </identity>\n' +
    '            <username>' + destuser + '</username>\n' +
    '        </GetUserProfile>\n' +
    '    </soap12:Body>\n' +
    '</soap12:Envelope>\n';
        try
        {
            xmlhttp.open("post", "http://forum.csdn.net/OpenApi/forumapi.asmx", false);
            xmlhttp.setRequestHeader("CONTENT-LENGTH", contentText.length);
            xmlhttp.setRequestHeader("CONTENT-TYPE", "text/xml; charset=utf-8");
            xmlhttp.send(contentText);
            return xmlhttp.responseText;
        }
        catch (e)
        {
            return "";
        }
    }/// <summary>
    /// 分析用户积分信息
    /// </summary>
    /// <param name="profileText">用户的XML信息</param>
    /// <returns>返回构造的用户积分信息</returns>
    function UserProfile(profileText)
    {
        profileText = profileText.replace(/\r\n/g, " ");
        var re = /\<errId\>(.*?)\<\/errId\>/g;
        if (re.exec(profileText)) this.errId = RegExp.$1; // 错误号    var re = /\<errInfo\>(.*?)\<\/errInfo\>/g;
        if (re.exec(profileText)) this.errInfo = RegExp.$1; // 错误信息
        
        var re = /\<point\>(.*?)\<\/point\>/g;
        if (re.exec(profileText)) this.point = RegExp.$1; // 可用分
        
        var re = /\<nickName\>(.*?)\<\/nickName\>/g;
        if (re.exec(profileText)) this.nickName = RegExp.$1; // 昵称
        
        var re = /\<username\>(.*?)<\/username\>/g;
        if (re.exec(profileText)) this.username = RegExp.$1; // 用户名
        
        var re = /\<techExpertPoint\>(.*?)\<\/techExpertPoint\>/g;
        if (re.exec(profileText)) this.techExpertPoint = RegExp.$1; // 专家分    var re = /\<nonTechExpertPoint\>(.*?)\<\/nonTechExpertPoint\>/g;
        if (re.exec(profileText)) this.nonTechExpertPoint = RegExp.$1; // 水分
    }String.prototype.trim = function() 

        return this.replace(/(^\s*)|(\s*$)/g, ""); 
    } /// <summary>
    /// 开始按钮点击事件
    /// </summary>
    function ButtonStartClick()
    {
        var userProfile = new UserProfile(
            GetUserProfile(textUsername.value, textPassword.value, textDestuser.value.trim()));
        if (userProfile.errId == 0)
        {
            textareaLog.value += 
                "-------\r\n" + 
                "用户名:" + userProfile.username + "\r\n" +
                "昵 称:" + userProfile.nickName + "\r\n" +
                "专家分:" + userProfile.techExpertPoint + "\r\n" +
                "水 分:" + userProfile.nonTechExpertPoint + "\r\n" +
                "可用分:" + userProfile.point + "\r\n";
        }
        else AppendLog("错误:#" + userProfile.errId + "原因:" + this.errInfo + "\r\n");
    }</script>
    </body>
    </html>
      

  16.   

    能不能给个例子给我啊。25楼的,many thanks