I am using VBScript to access a remote database server via a web service. I
am trying to call a web method that hits a database and runs the query I pass
in as a parameter and returns the results. However, I am being returned an
error that says the CommandText property has not been initialized. I
researched the error, and I discovered that my sqlQuery parameter is not
reaching the web service, so the service is trying to execute a blank
command, which throws the error. I thought I was properly forming my SOAP
command to pass the parameter, but maybe I am not. Here is the VBScript code
to form the SOAP command and send it:

Dim strSoapAction
Dim strUrl
Dim strXml
Dim strParam
Dim xmlDOC

Set xmlDOC = CreateObject("MSXML2.DOMDocument.6.0")

strParam = "SELECT KeyField, DataField FROM TestTable WHERE StatusField =
'Bad'"
strUrl = "http://localhost/MOM_POC_DummyService/DataService.asmx"
strSoapAction = "http://tempuri.org/GetDBData"


strXml = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<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/"">" & _
"<soap:Body>" & _
"<CheckActCode xmlns=""http://tempuri.org/"">" & _
"<actCode>" & strParam & "</actCode>" & _
"</CheckActCode>" & _
"</soap:Body>" & _
"</soap:Envelope>"

xmlDOC.loadXML(PostWebservice(strUrl, strSoapAction, strXml))


And here is the PostWebService function:


Function PostWebservice(AsmxUrl, SoapActionUrl, XmlBody)
Dim objDom
Dim objXmlHttp

' Create objects to DOMDocument and XMLHTTP
Set objDom = CreateObject("MSXML2.DOMDocument")
Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")

' Load XML
objDom.async = False
objDom.loadXML XmlBody

' Open the webservice
objXmlHttp.open "POST", AsmxUrl, False

' Create headings
objXmlHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXmlHttp.setRequestHeader "SOAPAction", SoapActionUrl

' Send XML command
objXmlHttp.send objDom.xml

PostWebservice = objXmlHttp.responseXml.xml

End Function



This code works and returns data when I call web methods that do not require
passed parameters, but this web method requires a single parameter (string
sqlQuery).

Any help would be greatly appreciated as to what I am doing wrong.

Thanks in advance