Classic ASP and Web Services that are password protected

S

Sparticus

Hello,

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 = "<b>That zipcode is within this city:</
b><font color = blue>" & node.text & "</font>"
Exit Function
Else
consumeWebService = "<b>There is no location associated with
that zipcode.</b>"
Exit Function
End If
End Function

%>
 
B

Bookham Measures

Sparticus said:
Hello,

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 = "<b>That zipcode is within this city:</
b><font color = blue>" & node.text & "</font>"
Exit Function
Else
consumeWebService = "<b>There is no location associated with
that zipcode.</b>"
Exit Function
End If
End Function

%>

RTFM

Sub open(ByVal bstrMethod As String, ByVal bstrUrl As String, [ByVal
varAsync], [ByVal bstrUser], [ByVal bstrPassword])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top