Solved

http post from excel using macro

Posted on 2014-07-20
2
1,041 Views
Last Modified: 2014-07-21
Folks

How can I build an http call in a vb macro and parse the results into excel, the code works

POST http://testproject:80/integration/os/resources
Content-Type: text/xml
<max:QueryRESOURCES xmlns:max="http://www.vendor.com/projects">
 <max:RESOURCES Query>
  <max:WHERE>upper(FIRSTNAME) like 'A%'</max:WHERE>
 </max:RESOURCES Query>
</max:QueryRESOURCES
0
Comment
Question by:rutgermons
2 Comments
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 40208035
Have you tried using the msxml2.xmlhttp object to handle the send and capture the response?
In the following example, I used testproject.com:80
Example:
    Dim strXML, oXML, strResponse
    Set oXML = CreateObject("msxml2.xmlhttp")
    oXML.Open "POST", "http://testproject.com:80/integration/os/resources", False
    oXML.setrequestheader "Content-Type", "text/xml"
    strXML = "<max:QueryRESOURCES xmlns:max=""http://www.vendor.com/projects"">"
    strXML = strXML & "<max:RESOURCES Query>"
    strXML = strXML & "<max:WHERE>upper(FIRSTNAME) like 'A%'</max:WHERE>"
    strXML = strXML & "</max:RESOURCES Query>"
    strXML = strXML & "</max:QueryRESOURCES>"
    oXML.Send strXML
    
    strResponse = oXML.responsetext

Open in new window

http://support.microsoft.com/kb/290591
0
 

Author Comment

by:rutgermons
ID: 40208429
thanks! i'll prob ask a follow up question on this in how to map the xml to columns (next step)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question