Buen día!
Tengo un problema con un WebService, actualmente sé como comsumirlo y como leer los datos que me arroje pero esto colo un contexto anónimo de autenticación, es decir, el problema es que yo necesito habilitar la Autenticación de Windows, si fuese desde .NET sólo necesitaría pasarle las credenciales mediante algo que se llama NetworkCredentials seteo el usuario y el password y listo, pero como puedo hacer esto desde ASP?, es decir, si el WS sólo permite el acceso a "USUARIO", "123", cómo hago para pasarle estas credenciales?, aquí abajo está mi funcion para levantar el request y cargar el XML que el WS me arroja
Código:
Function CreateSOAPRequest()
soapServer = "localhost"
soapPath = "/MyService/Service.asmx"
strWebMethod = "GetData"
Dim xmlhttp, strSoap
set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
strSoap = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soap:Body>" & _
"<" & strWebMethod & " xmlns=""http://tempuri.org/"" />" & _
"</soap:Body>" & _
"</soap:Envelope>"
'Send Soap Request
xmlhttp.Open "POST", "http://" & soapServer & soapPath, False ' False = Do not respond immediately
xmlhttp.setRequestHeader "Man", "POST " & soapPath & " HTTP/1.1"
xmlhttp.setRequestHeader "Host", soapServer
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", "http://tempuri.org/" & strWebMethod
xmlhttp.send(strSoap)
'response.Write(strSoap)
If xmlhttp.Status = 200 Then ' Response from server was success
CreateSOAPRequest = xmlhttp.responseText
Else ' Response from server failed
CreateSOAPRequest = ("Temporary Error.")
End If
set xmlhttp = nothing
End Function