[thelist] ASP.NET Posting an xml file?

Casey Crookston caseyc at IntelliSoftmn.com
Mon Sep 25 09:22:47 CDT 2006


>> I'm trying to work with UPS to integrate shipping from a client's
website.  To my surprise, UPS does not use web services, so we'll be
doing the old fashioned SML file posting via HTTP.  If I have an address
to which an xml file can be posted via HTTP, and I have the XML file,
how do I actually post the file to the address?  I've been goggling
variations of "asp.net post xml file http" with out any success.
Thanks,<<

 

Ok, I found this:

 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml
/html/xml12182000.asp?frame=true&hidetoc=true

 

The important part being this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How Do You Post the XML?

Well, from a JScript file or HTML page you can use the XMLHTTP control
provided by MSXML as follows:

   http = new ActiveXObject("Microsoft.XMLHTTP");
   http.open("POST", url, false);
   http.setRequestHeader("Accept","text/xml");
   http.setRequestHeader("Cache-Control","no-cache");
   http.setRequestHeader("SOAPAction",'""');
   http.send(msg);

In this case I decided to be a good SOAP citizen by setting the
SoapAction in the HTTP Header. I also decided to accept only text/xml
results and turn off all caching, since I want live results every time.
Of course, in my attached sample code I do this asynchronously using the
onreadystatechange callback.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

As is often the case with msdn articles, it is 90% helpful.  How and
where do you specify the xml file, or xml string that is being posted?
And, this is using SOAP, which UPS does not support.  How would I do
this using nothing but HTTP?

 

Thanks, 

 

Casey

 




More information about the thelist mailing list