Const URL = "http://www.domain.com/folder/service.asmx"
Const nsUrl = "http://www.domain.com/namespace-name"


' Create the http request text
Dim strSoapReq
strSoapReq = GenerateSoapBodyStart()
strSoapReq = strSoapReq + GenerateSoapFunctionCallStart("WebServiceFunctionName")
strSoapReq = strSoapReq + GenerateSoapParameter("paramName1", paramValue1)
strSoapReq = strSoapReq + GenerateSoapParameter("paramName2", paramValue2)
strSoapReq = strSoapReq + GenerateSoapFunctionCallEnd("WebServiceFunctionName")
strSoapReq = strSoapReq + GenerateSoapBodyEnd()

Dim oHttp
Dim strResult
Set oHttp = CreateObject("Msxml2.XMLHTTP")
oHttp.open "POST", URL, false
oHttp.setRequestHeader "Content-Type", "text/xml"
oHttp.setRequestHeader "SOAPAction", URL + "WebServiceFunctionName"
oHttp.send strSoapReq
strResult = oHttp.responseText

' parse XML in strResult




Function GetResult(byval responseText, byval resultParam)
	
	Dim oXml
	Set oXml = CreateObject("Msxml2.DOMDocument")
	oXml.Async = true
	oXml.LoadXml responseText

	Dim strPath
	strPath = "/*/*/*/" + resultParam
	Dim oNode
	Set oNode = oXml.documentElement.SelectSingleNode(strPath)
	GetResult = oNode.Text
	
End Function 


Function GenerateSoapBodyStart()
	
	Dim strSoap
	strSoap = "<?xml version=""1.0"" encoding=""utf-8""?>"
	strSoap = strSoap + "<soap12:Envelope "
	strSoap = strSoap + "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" "
	strSoap = strSoap + "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "
	strSoap = strSoap + "xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope""> "
	strSoap = strSoap + "<soap12:Body>"
	GenerateSoapBodyStart = strSoap
	
End Function

Function GenerateSoapBodyEnd()

	Dim strSoap
	strSoap = "</soap12:Body>"
	strSoap = strSoap + "</soap12:Envelope>"
	GenerateSoapBodyEnd = strSoap
	
End Function

Function GenerateSoapFunctionCallStart(byval strFunction)

	Dim strSoap
	strSoap = "<" + strFunction + " xmlns=""" + nsUrl + """>"
	GenerateSoapFunctionCallStart = strSoap
	
End Function

Function GenerateSoapFunctionCallEnd(byval strFunction)

	Dim strSoap
	strSoap = "</" + strFunction + ">"
	GenerateSoapFunctionCallEnd = strSoap
	
End Function

Function GenerateSoapParameter(byval strParam, byval strValue)

	Dim strSoap
	strSoap = "<" + strParam + ">"
	strSoap = strSoap + strValue
	strSoap = strSoap + "</" + strParam + ">"
	GenerateSoapParameter = strSoap
	
End Function
