Solved

http post from excel using macro

Posted on 2014-07-20
2
931 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
Comment Utility
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
Comment Utility
thanks! i'll prob ask a follow up question on this in how to map the xml to columns (next step)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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‚Ķ
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

763 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

8 Experts available now in Live!

Get 1:1 Help Now