ASP VBScript


This shows a code snippet of how to call a web method in ASP.

This does not use the Authenticate method.

<%@ Language=VBScript %>
 
<%
 
strService = "http://999.999.999.999/xweb/secure/netForumXML.asmx/"
 
strPostUrl = strService + "XYZGetIndustryCategory"
 
cPostData = "?code=" + Server.URLEncode(Request("category_code"))
 
 
' Send data to service
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "POST", strPostUrl, False
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXMLHTTP.Send cPostData
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
 
 
' create XML doc to parse response
Set xml = Server.CreateObject("Msxml2.DOMDocument")
xml.loadXML(strReturn)
 
if xml.hasChildNodes=true then
 
' first child node
Set objChildNodes = xml.documentElement.childNodes
 
 
For Each objNode In objChildNodes
 
set objMemberNodes = objNode.childNodes
 
' each element in Member results
for each memberNode in objMemberNodes
 
strColumnName = memberNode.nodeName
 
xColumnValue = ""
 
' make sure there is data
if memberNode.hasChildNodes( ) then
xColumnValue = memberNode.firstChild.text
end if
 
Response.Write(strColumnName + "=")
Response.Write(xColumnValue + "<br>")
 
next
next
 
end if
 
%>

See Also