Solved

How to use Microsoft.XMLHTTP object in ChiliSoft ASP

Posted on 2003-11-20
7
761 Views
Last Modified: 2012-08-13
Hello Experts,
       I am running ASP(VBScript) on the Linux server with the support of ChiliSoft 3.6 ASP, but this does not support Microsoft.XMLHTTP object, which I m using in my Script to Send and receive information to a URL, in which I m passing my data to a URL and processing its response.

Is anybody have solution for problem or can anybody let me know any other object that will work on ChiliSoft 3.6 and functions the same.

Thank You
Kishan
0
Comment
Question by:Kishan
7 Comments
 
LVL 21

Accepted Solution

by:
ap_sajith earned 250 total points
ID: 9795188
Could you try the following?

<%
Function CreateXMLObj(XMLType)
dim tmpObj,n
dim ObjArray

select case UCase(XMLType)
case "DOM"
ObjArray = Array("Microsoft.XMLDOM","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument.4.0")
case "HTTP"
ObjArray = Array("Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP.4.0","MSXML2.ServerXMLHTTP.3.0","MSXML2.ServerXMLHTTP.4.0")
case else
'debugging code removed
Set CreateXMLObj = nothing
exit function
end select

On Error Resume Next

'test in reverse order to get "best" version
for n = UBound(ObjArray) to 0 step -1
set tmpObj = CreateObject(ObjArray(n))

If Err Then
'debugging code removed
set tmpObj = nothing
Err.Clear
Else
'debugging code removed
exit for
End If
next

If not IsObject(tmpObj) then
'debugging code removed
CreateXMLObj = nothing
exit function
End If

set CreateXMLobj = tmpObj
end function
%>


Use like this:

<%
set XMLHTTP = CreateXMLObj("HTTP")
set XMLDOM = CreateXMLObj("DOM")
%>

This code snippet is from this excellent discussion at http://www.sitepointforums.com/archive/index.php/t-54526 ... Checkout the second post by alexming as well...

You could use either of the two to find what version of XMLHTTP component you have on the server.

Hope this helps...
Cheers!!
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9795209
Another great script... Checks what versions of XMLHTTP you have on the server...

<%@LANGUAGE="JavaScript"%>
<html>
<head>
<title>MSXML Versions</title>
</head>
<body>
<h1>MSXML Versions on Server</h1>
<p>Following MSXML Parsers are installed on this server:</p>
<p>
<%
var strXMLText = "<?xml version=\"1.0\"?><ROOT></ROOT>";
var i=0;
//1
try
{
var objXMLDOM = new ActiveXObject("Microsoft.XMLDOM");
objXMLDOM.async=false;
if (objXMLDOM.loadXML(strXMLText))
{
Response.Write("[Yes] Microsoft.XMLDOM<br>");
i = i + 1;
}
}
catch (e)
{
Response.Write("[No] Microsoft.XMLDOM<br>");
}
//2
try
{
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument");
objXMLDOM.async=false;
if (objXMLDOM.loadXML(strXMLText))
{
Response.Write("[Yes] Msxml2.DOMDocument<br>");
i = i + 1;
}
}
catch (e)
{
Response.Write("[No] Msxml2.DOMDocument<br>");
}
//2.6
try
{
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.2.6");
objXMLDOM.async=false;
if (objXMLDOM.loadXML(strXMLText))
{
Response.Write("[Yes] Msxml2.DOMDocument.2.6<br>");
i = i + 1;
}
}
catch (e)
{
Response.Write("[No] Msxml2.DOMDocument.2.6<br>");
}
//3
try
{
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.3.0");
objXMLDOM.async=false;
if (objXMLDOM.loadXML(strXMLText))
{
Response.Write("[Yes] Msxml2.DOMDocument.3.0<br>");
i = i + 1;
}
}
catch (e)
{
Response.Write("[No] Msxml2.DOMDocument.3.0<br>");
}
//4
try
{
var objXMLDOM = new ActiveXObject("Msxml2.DOMDocument.4.0");
objXMLDOM.async=false;
if (objXMLDOM.loadXML(strXMLText))
{
Response.Write("[Yes] Msxml2.DOMDocument.4.0<br>");
i = i + 1;
}
}
catch (e)
{
Response.Write("[No] Msxml2.DOMDocument.4.0<br>");
}
%>
</p>
</body>
</html>

Cheers!!
0
 
LVL 32

Assisted Solution

by:shalomc
shalomc earned 250 total points
ID: 9795428
Kishan,
Sorry to disappoint you, but XMLHTTP is developed and supported by Microsoft, and exists only on MS platforms.
You will have to use a Java component, that will run on the Application server you have.


0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Kishan
ID: 9801840
Thank You ap_sajith for your excellent code.
         
          But unfortunately I had subscribed to a Shared Linux Server with ChiliSoft 3.6 which doesnt have any of the HTTP or DCOM objects as mentioned in your code.

I am using a code show below.

      str = Request.Form & "&cmd=_notify-validate"

     ' post back to PayPal system to validate
     ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
     ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
     set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
     objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
     objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
     objHttp.Send str

As in the above code, I am using these objects to send data and receive response from the mentioned url.
But as the objects doesnt supported on the Linux server I cant get it created.

If you have any other solution for such type of operation or any other object that support this operation, Please let me know

Waiting for your reply

Thank You
Kishan
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9863946
Hi Kishan,
I did dig around for other/similar components in Linux... unfortunately there doesnt seem to be any out there. So i guess you will have to do it the old way.. ie, post the data onto a page and then redirect back to your page.... or pass the values to a popup page which loads the page from the other server. You could pass the values to the popup via the querystring or do a post to it.

Cheers!!
0
 
LVL 6

Expert Comment

by:masirof
ID: 12841150
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split: ap_sajith &  shalomc

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

masirof
EE Cleanup Volunteer
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now