Solved

MSXML2.ServerXmlhttp.6.0 Error

Posted on 2013-11-22
6
2,229 Views
Last Modified: 2013-11-26
Set http = CreateObject("MSXML2.ServerXMLHTTP.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
0
Comment
Question by:JayeshIyer
  • 4
  • 2
6 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 39670818
I'm not sure that would work with Google.  Using a username and password implies you should be querying the HTTPS protocol instead of HTTP, but it may also be expecting a different URL to authenticate against.

On the other hand, if it's not resolving, are you behind a proxy that might be stopping it from reaching the URL?

If so, can you try the code from a direct link with no proxy?  Or you can try adding this:
http.setProxy 2, "myproxyserver:8080"
http.setProxyCredentials "MyUserName", "myPassword"

before the GET call.

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 39670819
There's also a good article on MSDN for troubleshooting such code here:
http://blogs.msdn.com/b/jpsanders/archive/2008/06/25/troubleshooting-code-that-uses-the-http-protocol.aspx

Rob.
0
 

Author Comment

by:JayeshIyer
ID: 39673908
Thanks rob for your comments.
This worked for the above code.

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.Send
WScript.ECHO http.ResponseText

But when i am using different url the below error is comming


Network Error (tcp_error)
Communication error
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 65

Expert Comment

by:RobSampson
ID: 39673980
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.
0
 

Author Comment

by:JayeshIyer
ID: 39677394
Yes rob i tried without proxy settings.then it gives the below error

A connection with the server could not be established.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 39679345
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.

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

Open in new window


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

Open in new window


Rob.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question