views:

7447

answers:

6

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.

Thank you all for your time!

+6  A: 

Here are a few articles describing how to call a web service from a class ASP page:

SitWalkStand
+10  A: 

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
KP
A: 

All you need is an HTTP client. In .Net, WebRequest works well. For classic ASP, you will need a specific component like this one.

Vincent Robert
+6  A: 

@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.

Kev
+2  A: 

@Kevin

Thanks for the Catch. I updated the XMLHTTP answer.

KP
+1  A: 

Another possibility is to use the WinHttp COM object Using the WinHttpRequest COM Object.

WinHttp was designed to be used from server code.

garretmagin