Classic ASP and Web Services that are password protected
am 21.08.2007 19:29:40 von SparticusHello,
First off I'll say I'm very new to web services.
I have a classic asp page that wants to connect to a web service and
get information. I have it working that it connects and can get
data.... but now we have added a username/password to the web
service... how do I modify my code to pass in a username and password
so that it works like it did before?
Thanks in advance!!
Here is the code I used to connect :
<% Response.Write(consumeWebService())
Function consumeWebService()
Dim webServiceUrl, httpReq, node, myXmlDoc
webServiceUrl = "http://MyWebService/LegalSurveySearch.asmx?
op=StateNames"
Set httpReq = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpReq.Open "GET", webServiceUrl, False
httpReq.Send
Set myXmlDoc =Server.CreateObject("MSXML.DOMDocument")
myXmlDoc.load(httpReq.responseBody)
httpReq = Nothing
node = myXmlDoc.documentElement.selectSingleNode("//StateNames")
If Not node Is Nothing Then
consumeWebService = "That zipcode is within this city:
b>" & node.text & ""
Exit Function
Else
consumeWebService = "There is no location associated with
that zipcode."
Exit Function
End If
End Function
%>