Solved

http post from excel using macro

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

24 Experts available now in Live!

Get 1:1 Help Now