Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Query ASP to GET XML via HTTP Post URGENT HELP PLEASE

From: "Joe Fawcett" <joefawcett@-------.--->
To: NULL
Date: 2/2/2005 11:26:00 AM
"Aliandro" <dr_ali_@h...> wrote in message
news:E6RLd.13808$mo2.1088273@n......
> 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,'usern
ame','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
>
>
>
>
I've never tried using a url in the send method. You could try loading the
xml first into a dom and then sending:
var oDom = new ActiveXDocument("msxml2.domdocument.4.0"); //Use version 3 if
4 not available.
oDom.async = false;
oDom.load("http://mywebsite/note.xml");
var  objHTTP = new ActiveXObject("msxml2.xmlhttp.4.0"); //Use version 3 if 4
not available.

and then as before but:
objHttp.send(oDom);

As a side issue your xml is invalid, it is illegal to have an element named
"XML" although some parsers don't complain.


-- 

Joe (MVP-XML)




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent