如何动态检索URL?

时间:2016-06-09 07:29:23

标签: vbscript

我在项目中使用了web服务。我给的网址是这样的:

WebServicename.asmx/Methodname

本地我在VBScript中使用了webservice,运行良好。但是当我在服务器中部署相同的代码时,webservice没有运行。所以在那个webservice之前我想提供完整的URL。因此,我想动态获取该URL并在我的URL之前添加。

1 个答案:

答案 0 :(得分:0)

我正在编写Vb脚本,我就像这样调用webservice

设置oXMLHTTP = CreateObject(“MSXML2.XMLHTTP.3.0”)

    Set oXMLDoc = CreateObject("MSXML2.DOMDocument")

    'Msgbox("Calling WebService To Approve Leave")

    strEnvelope ="varCarrierType="&varCarrierType &varCarrierID& "&Filename="&Filename& "&varC22Cnt="&varC22Cnt&"&varCurrentDateTime="&varCurrentDateTime&"&varTotalCommissionAmt="&varTotalCommissionAmt&"&vpath="&vpath

    oXMLHTTP.onreadystatechange = getRef("HandleStateChange")

    call oXMLHTTP.open("POST","/VBScriptService.asmx/InsertDBDetails",False)

    call oXMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")

    call oXMLHTTP.send(strEnvelope)
    MsgBox "COM File successfully generated from the Template given. Verify the output file in " & vpath,0, "Com File Generation"


    MsgBox "Page About to Refresh, Click ok to proceed", 0, "ComPage Refresh"
    Set wShell=CreateObject("WScript.Shell")
    wShell.SendKeys "{F5}"