Classic ASP and Web Services that are password protected

Classic ASP and Web Services that are password protected

am 21.08.2007 19:29:40 von 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 = "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

%>

Re: Classic ASP and Web Services that are password protected

am 23.08.2007 17:55:19 von Bookham Measures

"Sparticus" wrote in message
news:1187717380.973569.250370@22g2000hsm.googlegroups.com...
> 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 = "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
>
> %>
>

RTFM

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