Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTTP Request Problem

Posted on 2013-12-20
9
Medium Priority
?
466 Views
Last Modified: 2016-02-26
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
0
Comment
Question by:ttobin333
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 39734927
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?
0
 

Author Comment

by:ttobin333
ID: 39735050
As stated, the call works perfectly when running from within Visual Basic so the connection information is correct.
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 39735665
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.
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:ttobin333
ID: 39737250
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?
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 39738013
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)?
0
 
LVL 3

Accepted Solution

by:
CvD earned 2000 total points
ID: 39740839
From what I read it looks like your memory is "dirty". Meaning, the reference as addressed by objHTTP still lingers, because you do not close it properly. The connection is gone, but the pointer exists. Rebooting gives you a clean memory sleet, therefor it works again.

Destroy the object by nullifying it (i.e. objHTTP = null (or Nothing i don't know what you need in this case))
0
 

Author Comment

by:ttobin333
ID: 39744326
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.
0
 
LVL 3

Expert Comment

by:CvD
ID: 39744570
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.
0
 

Author Closing Comment

by:ttobin333
ID: 39760691
Thanks!
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

660 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