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 December 22nd, 2004, 12:50 PM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Request and Response from server in XML

Hi,
I am working on a project that requires me to send a request to a server in form of an XML file and recieve response in XML. Can someone tell me how this can be done

Thanks,
Smitha

 
Old December 23rd, 2004, 04:22 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

See this link and search for msxml2.domdocument in google.groups, hundreds of examples. Make sure you use the modern classes, msxml2.domdocument, NOT microsoft.xmldom.
http://msdn.microsoft.com/library/de...asp?frame=true



--

Joe (Microsoft MVP - XML)
 
Old December 23rd, 2004, 10:48 AM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dim HttpReq As New MSXML2.XMLHTTP30
HttpReq.open "GET", "http://localhost/books.xml", False
xmltext ="XML Here"
Dim xmldom As New MSXML2.DOMDocument
xmldom.loadXML xmltext
HttpReq.send(xmldom)
MsgBox HttpReq.responseXML

Is this correct?

Thanks
Smitha

 
Old December 24th, 2004, 07:20 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Almost, your xml is not xml (this might be the bulletin board though, and you use post if you are sending data on the send data:
Code:
 Dim HttpReq As New MSXML2.XMLHTTP30
HttpReq.open "POST", "http://localhost/books.xml", False
xmltext ="<root>XML Here</root>"
Dim xmldom As New MSXML2.DOMDocument
xmldom.loadXML xmltext
HttpReq.send(xmldom)
MsgBox HttpReq.responseXML
Your url won't be "http://localhost/books.xml" though, this will just return the contents of the xml file and will ignore your sent data. If you want to modify the response according to the data sent you need to use some sort of server side processing, ASP for example.
Code:
Set oDom = CreateObject("msxml2.domdocument.4.0")
oDom.async = False
oDom.load Request
'Examine oDom and then send back xml:
Response.contentType = "text/xml"
'...

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
XML request and get response praveenkumar .NET Web Services 0 May 23rd, 2007 04:13 AM
send XML Request and get XML Response prashant_dnmmkpk VB.NET 2 February 25th, 2005 03:34 PM
Request-response in Tomcat sherbir Servlets 0 September 4th, 2004 04:26 AM
Help sending XML file to server, reading response bradartigue XML 1 September 5th, 2003 07:42 AM





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