HTTP request-response efficiency

This code has been used for over 8 years on various projects at the software company I do work for.  The code calls a dll that consumes various xml requests for data access, other functionality and returns xml with data, status of request, etc.  

I am seeking help and guidance with the following questions:

1.  Should the oServerHTTP object be terminated after use?  If so, how  .close?  = nothing?
2.  Is there a more efficient object  than MSXML2 or different methodology to use to make the request and manage responses?
Open to non-Microsoft technologies (node.js,, etc)
3.  In terms of reducing strain on the server, what are the key factors that go into improving the use of this dll?
4.  Are there any viable hardware appliances or other hardware possibilities that should be considered to improve efficiency and throughput between http requests and the dll?

This question is posed in order to broaden my base knowledge in order to make better recommendations and decisions.  Please feel free to point me to particular buzz words, google searches, etc as part of the answer.

Here is the sample code that is used repeatedly:

Set oServerHTTP = Server.CreateObject("MSXML2.SERVERXMLHTTP") "POST", "http://localhost/myerp/isapi/erpwebrqb.dll", False
oServerHTTP.setOption(2) = 4096
oServerHTTP.send oSendDoc
If Not oServerHTTP.status = 200 Then
End If
set nodes = oServerHTTP.responseXML    

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KeithMcElroyAuthor Commented:
More info:  this code typically resides in an asp page that is called using ajax.  In other words, the asp page sits on the server and acts as a forwarding mechanism between the html page and the dll.  The request originates with a web page typically and the response is typically rendered on the requesting web page.
As an example, search for records in the database behind the dll and then splash the results in an html table.  Hope that makes this more specific.
Ray PaseurCommented:
For some unknown reason I got a "Neglected Question" alert, and as if by cosmic forces, I who know nothing about ASP and can barely spell DLL was just having a conversation about this very topic yesterday.

XML is declining in use, largely because the propellant-to-payload ratio is about twice as high as JSON.  See example below. This is not an ASP script obviously, but you can run it on my server to see the differences.  Mostly the JSON advantage appears because there is no need for a closing tag on each data element.  So if the amount of traffic to and from the server is a concern, switching from XML to JSON may be a good move.

JSON requires UTF-8 character encoding.  That doesn't matter if your data is ASCII text, but if you've got Windows-1252 or ISO-8859-1 characters above code point 127 there may be collisions with the UTF-8 signal byte.  Worth testing, maybe with iconv.  Also, if you're sending binary data, you may need a binary-safe transport encoding, such as base64 encoding.

Comparing the transport overhead:

<?php // RAY_json_xml.php
echo "<pre>";


$xml = <<<XML
<?xml version="1.0" ?>
    <email />

$obj = SimpleXML_Load_String($xml);

$jso = json_encode($obj);

$pay = strip_tags($xml);
$pay = trim(preg_replace('#\s\s+#', ' ', $pay));

$xml_len = strlen($xml);
$jso_len = strlen($jso);
$pay_len = strlen($pay);

$jso_pay = number_format( ($pay_len / $jso_len) * 100);
$xml_pay = number_format( ($pay_len / $xml_len) * 100);

echo PHP_EOL . "THE PAYLOAD IS $pay_len BYTES";
echo PHP_EOL . $pay;
echo PHP_EOL;

echo PHP_EOL . "THE JSON    IS $jso_len BYTES";
echo PHP_EOL . "THE PAYLOAD / JSON RATIO IS $jso_pay%";
echo PHP_EOL . $jso;
echo PHP_EOL;

echo PHP_EOL . "THE XML     IS $xml_len BYTES";
echo PHP_EOL . "THE PAYLOAD / XML RATIO IS $xml_pay%";
echo PHP_EOL . htmlentities($xml);
echo PHP_EOL;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
Thanks for the points - hope it was helpful, ~Ray
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTTP Protocol

From novice to tech pro — start learning today.