Raphael Banks
Raphael Banks

Reputation: 3

VBScript Missing Parameter in web service

I'm having some difficulties to consume a Web Service in VBScript. Everytime I try to run it presents some error (Missing parameters / Internal server error / Status 500). I don't know what can be wrong. can you give me some help?

Here's my VBScript code:

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

And here is my Web Service. Very simple:

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";
    }
}
}

Sorry. I'm noob at this. Any help is very appreciated.

Thank you!!!

Upvotes: 0

Views: 1553

Answers (1)

yW0K5o
yW0K5o

Reputation: 943

Please, see 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

Upvotes: 1

Related Questions