Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 03:13 PM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bradartigue
Default Help sending XML file to server, reading response

Hello. I'm working with a mapping service that has sent me plenty of code examples in Java and CGI, but I'm having trouble with the conversion to ASP .NET.

The conversation will execute upon start of an aspx form (and is therefore located in the Sub Page_Load). I have the code below but cannot figure out how to directly send the XML file to the server. I've tried reading the XML to a string and sending the string, but that seems to be a real stupid way of transmitting that file.

In synopsis, I want to send map.xml to their server and read the response. The response is a .GIF. Help is appreciated!

Code looks like this (but is obviously not what I need). Note that I don't think I should be using .send but should be using something that actually sends an XML file called "map.xml". Hell, all I need to know is to post and read response - .NET making me feel foolish.

        Dim oHTTP As New Object()
        Dim sResponseXML As String
        oHTTP = Server.CreateObject("Microsoft.XMLHTTP")
        oHTTP.open("POST", "http://www.maptuit.com/XMLServer/Request.xs", False)
        oHTTP.setRequestHeader("Content-Type", "text/xml")
** oHTTP.send("<the XML that I want to be a file>")
        sResponseXML = oHTTP.responseText
        oHTTP = Nothing

 
Old September 5th, 2003, 07:42 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The help file with Msxml Core Services from Microsoft has lots of examples of this. Normally you just send the DomDocument itself:
Code:
oHTTP = Server.CreateObject("Msxml2.XMLHTTP.4.0")
oHTTP.open "POST", "http://www.maptuit.com/XMLServer/Request.xs", False

oDom = CreateObject("Msxml2.DomDocument.4.0")
oDom.loadXML "<myDocument/>"
oHTTP.send(oDom)
If oHTTP.status = 200 Then
  oHTTP.responseXML.save Response
Else
   Response.write "Error: " & oHTTP.statusText
End If
That's in traditional ASP. For net you can use the built in stuff rather than you COM interop.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
Sending email problem - SMTP server response: 554 Havokx Beginning PHP 0 July 27th, 2007 04:04 AM
Error in Sending XMl file to Server r_arvindk2000 XML 0 April 8th, 2005 01:52 PM
Error in sending XML file to server r_arvindk2000 XML 0 April 8th, 2005 01:49 PM
Request and Response from server in XML snarreddi XML 3 December 24th, 2004 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.