Link to home
Start Free TrialLog in
Avatar of ttobin333
ttobin333

asked on

HTTP Request Problem

Dear Experts,

I am having problems with an HTTP request within my VB6 application.  It works perfectly when running the code in the VB6 development environment but not from the compiled EXE file.

When running the EXE, I am getting error -2146697211 at the objHTTP.send strEnvelope command.

The identical call works from within another similar app without problems, making me wonder if some kind of reset command is required.

The code is below.

Thanks for your help!

///////////////////////////////////////////////

Dim objHTTP As New MSXML2.XMLHTTP
Dim strEnvelope As String
Dim strReturn As String
Dim objReturn As New MSXML2.DOMDocument
Dim nodeReturned As IXMLDOMNode
Dim xStatus As String

'load xml file to be posted to the server
strEnvelope = https://www.xyz.com/jsp/validateKey.jsp?...

objHTTP.Open "get", strEnvelope, False

'Make the SOAP call
objHTTP.send strEnvelope

'Load the return envelope into a DOM
objReturn.Load objHTTP.responseBody

'Query the return envelope
Set nodeReturned = objReturn.selectSingleNode("//status")

xStatus = nodeReturned.Text
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

The error number -2146697211 means that the server or proxy server you are trying to connect to cannot be found.  Is it possible that your hosts file is incorrect somehow?
Avatar of ttobin333
ttobin333

ASKER

As stated, the call works perfectly when running from within Visual Basic so the connection information is correct.
Yes, I read that :)

Running the app from within the IDE is not the same as running the bare exe, because it is possible that the IDE may be elevating the exe, hence it has permission to read the hosts file.
After a reboot, it started working again but I need this to be as reliable as possible. What can I do to make it more robust?
What was the result of running the app as administrator?  Also, have you tried running it on a completely clean machine (say, a virtual one)?
ASKER CERTIFIED SOLUTION
Avatar of CvD
CvD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for the responses.

CvD, this sounds like a good idea. Will try it as soon as I can make the error occur again.

Mrwad99, running as administrator did not solve the problem.

Thanks.
You should alway cleanup unless you are absolutely certain the programming language will do a proper job cleaning up. In case of any doubt as to this matter, cleanup before you proceed. I.e. nullify objHTTP and objReturn wheather you get the error or not.
Thanks!