使用vbscript脚本调用web服务http://www.csdn.net/develop/read_article.asp?id=24518

解决方案 »

  1.   


    .net 1.1默认不支持post和get的协议, 要支持的话, 请打开machine.config
    其中<webServices>的配置改成这样:
            <webServices>
                <protocols>
                  <add name="HttpSoap"/> 
                  <add name="HttpPost"/> 
                  <add name="HttpGet"/> 
                  <add name="Documentation"/> 
                </protocols> 然后这样调用:
    http://localhost/webapplication4/ser.asmx/HelloWorld?str=jojo
      

  2.   

    <%@ Language=VBScript %>
    <%Response.Buffer =true%>
    <hr>
    <%
    Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP")
    Set xmlDOC =Server.CreateObject("MSXML.DOMDocument")
    strWebserviceURL = "http://localhost:8082/SerCom.asmx/GtGuid"
    '设置参数及其值
    strRequest = ""
    objHTTP.Open "POST", strWebserviceURL, False
    '设置这个Content-Type很重要
    objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.Send(strRequest)
    bOK = xmlDOC.load(objHTTP.responseXML)
    dim iSID
    iSID=""'看看状态值
    if objHTTP.Status=200 then
    iSID = xmlDOC.xml
    Response.Write "source code return :" & xmlStr &"<br>"
      
    else
       Response.Write objHTTP.Statu&"<br>"
       Response.Write objHTTP.StatusText
    end if
    %>