【问题标题】:VBScript Missing Parameter in web serviceWeb 服务中的 VBScript 缺少参数
【发布时间】:2014-07-08 18:42:22
【问题描述】:

我在使用 VBScript 中的 Web 服务时遇到了一些困难。每次我尝试运行它都会出现一些错误(缺少参数/内部服务器错误/状态 500)。我不知道有什么问题。你能给我一些帮助吗?

这是我的 VBScript 代码:

Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")

Set oXMLDoc = CreateObject("MSXML2.DOMDocument")

oXMLHTTP.open "POST","http://192.168.0.32:9090/webservice1.asmx/Conecta?
sID=1",False

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

oXMLHTTP.send()

msgBox oXMLHTTP.Status
msgbox oXMLHTTP.StatusText
msgbox oXMLHTTP.responseText

这是我的网络服务。很简单:

namespace WebApplication1
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http:// tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
 [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{

    [WebMethod]
    public string Conecta(string sID)
    {
       if (sID == "1")
        {
         return "ok";
        }
        return "Not ok";
    }
}
}

对不起。我对此很陌生。非常感谢任何帮助。

谢谢!!!

【问题讨论】:

    标签: web-services web service vbscript


    【解决方案1】:

    请看this reference

    Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")
    
    Set oXMLDoc = CreateObject("MSXML2.DOMDocument")
    
    oXMLHTTP.open "POST","http://192.168.0.32:9090/webservice1.asmx/Conecta",False
    
    oXMLHTTP.setRequestHeader"Content-Type","application/x-www-form-urlencoded"
    
    oXMLHTTP.send "sID=1"
    
    msgBox oXMLHTTP.Status
    msgbox oXMLHTTP.StatusText
    msgbox oXMLHTTP.responseText
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-24
      • 1970-01-01
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-24
      相关资源
      最近更新 更多