There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
XML Request


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Alex147's Avatar
Junior Member with 3 posts.
 
Join Date: Oct 2004
Experience: Intermediate
30-Oct-2004, 07:33 AM #1
XML Request
I have an xml request of the follwing form:

Code:
  <?xml version="1.0" encoding="UTF-8" ?> 
- <Car xmlns="url" xmlns:xsi="url" Target="test" Version="2002A">
  <SyndicatorInfo SyndicatorId="id" SyndicatorPassword="pass" /> 
  <SessionInfo CreateNewSession="true" /> 
  <ConsumersContext Reference="your_reference_here" /> 
- <CarSearchRequest>
- <SearchCriteria CarOnly="false">
  <CarPurchaseDate StartDate="20041101" EndDate="20041108" /> 
- <CarManufacturer>
  <Car>A</Car> 
  <Car>Z</Car> 
  </CarManufacturesr>
- <CarChoice>
- <CarManufacturers>
  <Car>A</Car> 
  <Car>IBZ</Car> 
  </CarManufacturers>
  </CarChoice>
  <CarAge MinCarAge="7" MaxCarAge="7" /> 
  </SearchCriteria>
  <ResultSetPreferences SortCode="cost" SortAscending="true" MaxItems="300" /> 
  <InitialViewInfo Offset="0" Length="50" /> 
  </CarSearchRequest>
  </Car>

I need to send this request to a remote server (Address specified above as "url"), to obtain the resulting xml document. Any help on how to do this would be much appreciated.
CraigCKlein's Avatar
Junior Member with 20 posts.
 
Join Date: May 2004
Location: Blue Bell, PA
Experience: Advanced
05-Nov-2004, 01:44 AM #2
I just had to do this exact same thing. I used MS Access as my tool. But you could use VB or even Excel (or as someone will tell you c++, c#, etc, etc) But this example is for VB/VBA based products.

Here is the code I wrote:

You have to add the following reference (hopefully you know how to do this already

Microsoft WinHTTP Services


Public Sub Test()
Dim webReq As New WinHttpRequest
Dim strResponse as String
Dim strXML as String
webReq.Open "POST", "https://URL_TO_POST_TO"
strXML = "<?xml version='1.0' encoding = 'UTF-8'?>" _
& vbCrLf & "<YOUR_XML>" _
& vbCrLf & " <Session>" _
& vbCrLf & " </Session>" _
& vbCrLf & " <Request>" _
& vbCrLf & " <Name>" _
& vbCrLf & " </Name>" _
& vbCrLf & " </Request>" _
& vbCrLf & "</YOUR_XML>"

webReq.Send strXML
webReq.WaitForResponse
strResponse = webReq.ResponseText
debug.print strResponse
End Sub

You could also read the XML file into the strXML variable if you wanted.

Hope this helps
Craig
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:04 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.