Solved

http post from excel using macro

Posted on 2014-07-20
2
990 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now