Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling REST web services from a classic asp page

I'd like to start moving our application business layers into a collection of REST web services. However, most of our Intranet has been built using Classic ASP and most of the developers where I work keep programming in Classic ASP. Ideally, then, for them to benefit from the advantages of a unique set of web APIs, it would have to be called from Classic ASP pages.

I haven't the slightest idea how to do that.

like image 440
Louis Salin Avatar asked Aug 14 '08 15:08

Louis Salin


2 Answers

You could use a combination of JQuery with JSON calls to consume REST services from the client

or

if you need to interact with the REST services from the ASP layer you can use

MSXML2.ServerXMLHTTP

like:

Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP") HttpReq.open "GET", "Rest_URI", False HttpReq.send 
like image 150
KP. Avatar answered Sep 21 '22 07:09

KP.


@KP

You should actually use MSXML2.ServerXMLHTTP from ASP/server side applications. XMLHTTP should only be used client side because it uses WinInet which is not supported for use in server/service apps.

See http://support.microsoft.com/kb/290761, questions 3, 4 & 5 and

http://support.microsoft.com/kb/238425/.

This is quite important, otherwise you'll experience your web app hanging and all sorts of strange nonsense going on.

like image 22
Kev Avatar answered Sep 24 '22 07:09

Kev