473,379 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Query ASP to GET XML via HTTP Post URGENT HELP PLEASE

Hi I am really stuck and need some expertise help please.
I have an XML file:
<XML>
<USER_INFO>
<USERNAME>username</USERNAME>
<PASSWORD>password%</PASSWORD>
</USER_INFO>
<SITE_INFO>
<SITE_NO>18856</SITE_NO>
</SITE_INFO>
</XML>

I am trying to use HTTP Post to send the above XML to an ASP page, this is
the code I am using to send the XML to the ASP Page.
<html>
<head>
<script type="text/javascript">
function getPage()
{
var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
objHTTP.Open('POST','http://websitetoxmlgateway/xmlgateway.asp',false,'username','password%')
//gateway where the ASP page is
objHTTP.Send("http://mywebsite/note.xml") //my xml file
document.all['A1'].innerText= objHTTP.status
document.all['A2'].innerText= objHTTP.statusText
document.all['A3'].innerText= objHTTP.responseText
document.all['A4'].innerText= objHTTP.responseXML
document.all['A5'].innerText= objHTTP.responseXML.nodeName;
}
</script>
</head>

<body onload="getPage()">
<h2>Using the HttpRequest Object</h2>

<p>
<b>status:</b>
<span ID="A1"></span>
</p>

<p>
<b>status text:</b>
<span ID="A2"></span>
</p>

<p>
<b>response:</b>
<br><span ID="A3"></span>
</p>

<p>
<b>response2:</b>
<br><span ID="A4"></span>
</p>
<p>
<b>response3:</b>
<br><span ID="A5"></span>
</p>
</body>
</html>

When I do the Post and run the above file on my server it tells me the
following Error Message.
<XMLRESPONSE><ERRORS><ERROR><COMPONENT>RX_RMS</COMPONENT><INTERFACE>IGateway</INTERFACE><METHOD>Execute</METHOD><TEXT>"USERNAME"
node missing or empty [2]</TEXT><DATETIME>02 Feb 2005
08:40:03</DATETIME></ERROR></ERRORS></XMLRESPONSE>

Any help is appreciated. Thanks for your time.
Ali
Jul 20 '05 #1
1 5458


Aliandro wrote:
Hi I am really stuck and need some expertise help please.
I have an XML file:
<XML>
<USER_INFO>
<USERNAME>username</USERNAME>
<PASSWORD>password%</PASSWORD>
</USER_INFO>
<SITE_INFO>
<SITE_NO>18856</SITE_NO>
</SITE_INFO>
</XML>

I am trying to use HTTP Post to send the above XML to an ASP page, this is
the code I am using to send the XML to the ASP Page.
<html>
<head>
<script type="text/javascript">
function getPage()
{
var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
objHTTP.Open('POST','http://websitetoxmlgateway/xmlgateway.asp',false,'username','password%')
//gateway where the ASP page is
objHTTP.Send("http://mywebsite/note.xml") //my xml file


I think the send method wants you to pass in a document itself as an
object or the XML as a string but what you have simply sends the string
with the URL. So try
var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
xmlDocument.async = false;
xmlDocument.load('http://mywebsite/note.xml');
objHTTP.send(xmlDocument);
for a start but take note that all that synchronous loading might be
easier for a quick test but in the end you should change to asynchronous
loading to not block the browser while XML is loaded/parsed respectively
sent.

In general script in a HTML page loaded via HTTP can only connect back
to the server the page comes from so I wonder whether those attempts
simply fail as you are trying to load XML from or POST XML to another
server.
So it is crucial if you have further problems that you tell us exactly
how you load that HTML page with the script, is that loaded from the
local file system (e.g. file: URL)? Then at least you would have a
chance to connect to different servers.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
5
by: shawn.dba | last post by:
Hello. Thank you in advance for your time. I'm trying to query a set of groups in ActiveDirectory and output the members of each group. I'm not receiving output. The object tab of one object...
2
by: TVDJR | last post by:
Hi, I haven't had much luck in finding anything on this subject matter. I have a decent understanding of localization techinques but am not quite sure about some of the more simple things related...
10
by: rup | last post by:
Hello, This is my first application on socket programming in vc++. I am facing problem that how to make connection to server, & make GET/POST request by HTTP. Please help me. Its urgent.......
11
by: Jialiang Ge [MSFT] | last post by:
Hello Peter, I once came across the same error "ExecuteReader requires the command to have a transaction when the connection assigned? with running two threads talking with the database. There...
2
by: Bill McCormick | last post by:
Hi, I'm building a C# VS2005 project and I need an elegant way to output query results to an string array or list<Tof delimited strings. Thanks, Bill
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.