Classic ASP and Web Services that are password protected

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

%>
Sparticus [ Di, 21 August 2007 19:29 ] [ ID #1801383 ]

Re: Classic ASP and Web Services that are password protected

"Sparticus" <sparticusREMOVE [at] thesparticusarena.com> wrote in message
news:1187717380.973569.250370 [at] 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 = "<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])
Bookham Measures [ Do, 23 August 2007 17:55 ] [ ID #1803199 ]
Webserver » microsoft.public.inetserver.asp.general » Classic ASP and Web Services that are password protected

Vorheriges Thema: FTP to Multiple Websites - Once.
Nächstes Thema: Moving from ASP Sessions to Database Sessions