JayeshIyer
asked on
MSXML2.ServerXmlhttp.6.0 Error
Set http = CreateObject("MSXML2.Serve rXMLHTTP.6 .0")
http.Open "GET", "http://www.google.com", False,userid,password
http.Send
WScript.ECHO http.ResponseText
The above code creating error as below
The server name or address could not be resolved
But this is working with MSXML2.XMLHTTP
http.Open "GET", "http://www.google.com", False,userid,password
http.Send
WScript.ECHO http.ResponseText
The above code creating error as below
The server name or address could not be resolved
But this is working with MSXML2.XMLHTTP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks rob for your comments.
This worked for the above code.
Set http = CreateObject("MSXML2.Serve rXMLHTTP.6 .0")
http.Open "GET", "https://jazz.visteon.com:9443/ccm", False,userid,password
http.setProxy 2, "136.17.0.7:83"
http.setProxyCredentials username, password
http.Send
WScript.ECHO http.ResponseText
But when i am using different url the below error is comming
Network Error (tcp_error)
Communication error
This worked for the above code.
Set http = CreateObject("MSXML2.Serve
http.Open "GET", "https://jazz.visteon.com:9443/ccm", False,userid,password
http.setProxy 2, "136.17.0.7:83"
http.setProxyCredentials username, password
http.Send
WScript.ECHO http.ResponseText
But when i am using different url the below error is comming
Network Error (tcp_error)
Communication error
Again, I'd make sure you can access that through the proxy, and try running the script from the same authorised user account as well.
ASKER
Yes rob i tried without proxy settings.then it gives the below error
A connection with the server could not be established.
A connection with the server could not be established.
Hmmm, I guess some sites may require that you send specific headers with the request. There is code here that may help:
http://zanstra.home.xs4all.nl/inTec/ServerXMLHTTP.htm
I have put it with your current code to see what happens.
Or, if the certificate isn't quite right, you can try this to ignore certificate errors:
Rob.
http://zanstra.home.xs4all.nl/inTec/ServerXMLHTTP.htm
I have put it with your current code to see what happens.
Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.Open "GET", "https://jazz.visteon.com:9443/ccm", False,userid,password
http.setProxy 2, "136.17.0.7:83"
http.setProxyCredentials username, password
http.setOption 2, 13056
http.setRequestHeader "Authorization", "Basic " & Base64Encode(userid & ":" & password)
http.Send
WScript.ECHO http.responseText
Function Base64Encode(inData)
'ripped from:
'http://www.pstruh.cz/tips/detpg_Base64Encode.htm
'rfc1521
'2001 Antonin Foller, PSTRUH Software, http://pstruh.cz
Const Base64 = _
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim sOut, I
'For each group of 3 bytes
For I = 1 To Len(inData) Step 3
Dim nGroup, pOut
'Create one long from this 3 bytes.
nGroup = &H10000 * Asc(Mid(inData, I, 1)) + _
&H100 * MyASC(Mid(inData, I + 1, 1)) + _
MyASC(Mid(inData, I + 2, 1))
'Oct splits the long To 8 groups with 3 bits
nGroup = Oct(nGroup)
'Add leading zeros
nGroup = String(8 - Len(nGroup), "0") & nGroup
'Convert To base64
pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _
Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _
Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _
Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)
'Add the part To OutPut string
sOut = sOut + pOut
Next
Select Case Len(inData) Mod 3
Case 1: '8 bit final
sOut = Left(sOut, Len(sOut) - 2) + "=="
Case 2: '16 bit final
sOut = Left(sOut, Len(sOut) - 1) + "="
End Select
Base64Encode = sOut
End Function
Function MyASC(OneChar)
If OneChar = "" Then MyASC = 0 Else MyASC = Asc(OneChar)
End Function
Or, if the certificate isn't quite right, you can try this to ignore certificate errors:
Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.Open "GET", "https://jazz.visteon.com:9443/ccm", False,userid,password
http.setProxy 2, "136.17.0.7:83"
http.setProxyCredentials username, password
http.setOption 2, 13056
http.Send
WScript.ECHO http.responseText
Rob.
http://blogs.msdn.com/b/jpsanders/archive/2008/06/25/troubleshooting-code-that-uses-the-http-protocol.aspx
Rob.