Sunday, October 25, 2009

Calling a REST Service from VB

I did not have much luck calling the Yahoo REST service, so I created my own web service using the MyEclipse tutorial and tested it out. The VB code to call the REST service is as follows:


Sub Macro1()

url = "http://jjh.virtual.vps-host.net:8080/restdemo/services/customers/0"

Dim HttpReq As Object
Set HttpReq = New WinHttpRequest

HttpReq.Open "GET", url, False
'or use GET instead of POST

HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

HttpReq.send
'HttpReq.send postmydata
'Note - if using GET set postmydata to ""

MsgBox (HttpReq.responseText)

End Sub

Now the next challange is to get the Microsoft XML parser working.

No comments:

Post a Comment

Cocktail Jazz for Beginners

  https://pianowithjonny.com/piano-lessons/how-to-play-beginner-cocktail-piano-in-3-steps/ https://www.pianogroove.com/jazz-piano-lessons/co...