<p>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.</p>

<p>I haven't the slightest idea how to do that. </p>

[{'answer_id': 11237, 'author': 'SitWalkStand', 'author_id': 509, 'author_profile': 'https://Stackoverflow.com/users/509', 'pm_score': 3, 'selected': False, 'text': '<p>Here are a few articles describing how to call a web service from a class ASP page:</p>\n\n<ul>\n<li><a href="https://web.archive.org/web/20210125161040/http://www.4guysfromrolla.com/webtech/070302-1.shtml" rel="nofollow noreferrer">Integrating ASP.NET XML Web Services with \'Classic\' ASP Applications</a> </li>\n<li><a href="http://www.dotnetjunkies.com/Tutorial/99CA4563-FBD4-411F-A9C6-FF9E8A0E664F.dcik" rel="nofollow noreferrer">Consuming XML Web Services in Classic ASP</a></li>\n<li><a href="http://www.aspfree.com/c/a/ASP/Consuming-a-WSDL-Webservice-from-ASP/" rel="nofollow noreferrer">Consuming a WSDL Webservice from ASP</a></li>\n</ul>\n'}, {'answer_id': 11238, 'author': 'KP.', 'author_id': 439, 'author_profile': 'https://Stackoverflow.com/users/439', 'pm_score': 6, 'selected': True, 'text': '<p>You could use a combination of JQuery with JSON calls to consume REST services from the client</p>\n\n<p>or</p>\n\n<p>if you need to interact with the REST services from the ASP layer you can use</p>\n\n<p>MSXML2.ServerXMLHTTP</p>\n\n<p>like:</p>\n\n<pre><code>Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP")\nHttpReq.open "GET", "Rest_URI", False\nHttpReq.send\n</code></pre>\n'}, {'answer_id': 11242, 'author': 'Vincent Robert', 'author_id': 268, 'author_profile': 'https://Stackoverflow.com/users/268', 'pm_score': 0, 'selected': False, 'text': '<p>All you need is an HTTP client. In .Net, WebRequest works well. For classic ASP, you will need a specific component like <a href="http://web.archive.org/web/20140829190201/http://www.coalesys.com/products/httpclient/features/default.asp" rel="nofollow noreferrer">this one</a>.</p>\n'}, {'answer_id': 11251, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 3, 'selected': False, 'text': '<p>@<a href="https://stackoverflow.com/questions/11219/calling-rest-web-services-from-a-classic-asp-page#11238">KP</a></p>\n\n<p>You should actually use <code>MSXML2.ServerXMLHTTP</code> from ASP/server side applications. <code>XMLHTTP</code> should only be used client side because it uses WinInet which is not supported for use in server/service apps. </p>\n\n<p>See <a href="http://support.microsoft.com/kb/290761" rel="nofollow noreferrer">http://support.microsoft.com/kb/290761</a>, questions 3, 4 &amp; 5 and</p>\n\n<p><a href="http://support.microsoft.com/kb/238425/" rel="nofollow noreferrer">http://support.microsoft.com/kb/238425/</a>. </p>\n\n<p>This is quite important, otherwise you\'ll experience your web app hanging and all sorts of strange nonsense going on.</p>\n'}, {'answer_id': 60343, 'author': 'garretmagin', 'author_id': 6208, 'author_profile': 'https://Stackoverflow.com/users/6208', 'pm_score': 0, 'selected': False, 'text': '<p>Another possibility is to use the WinHttp COM object <a href="http://msdn.microsoft.com/en-us/library/aa384079(VS.85).aspx" rel="nofollow noreferrer">Using the WinHttpRequest COM Object</a>.</p>\n\n<p>WinHttp was designed to be used from server code.</p>\n'}, {'answer_id': 4670659, 'author': 'ianmayo', 'author_id': 92441, 'author_profile': 'https://Stackoverflow.com/users/92441', 'pm_score': 2, 'selected': False, 'text': '<p>A number of the answers presented here appear to cover how ClassicASP can be used to consume web-services &amp; REST calls.</p>\n\n<p>In my opinion a tidier solution may be for your ClassicASP to just serve data in REST formats.  Let your browser-based client code handle the \'mashup\' if possible. You should be able to do this without incorporating any other ASP components.</p>\n\n<p>So, here\'s how I would mockup shiny new REST support in ClassicASP:</p>\n\n<ol>\n<li>provide a single ASP web page that acts as a landing pad</li>\n<li>The landing pad will handle two parameters:  verb and URL, plus a set of form contents</li>\n<li>Use some kind of switch block inspect the URL and direct the verb (and form contents) to a relevant handler</li>\n<li>The handler will then process the verb (PUT/POST/GET/DELETE) together with the form contents, returning a success/failure code plus data as appropriate.</li>\n<li>Your landing pad will inspect the success/failure code and return the respective HTTP status plus any returned data</li>\n</ol>\n\n<p>You would benefit from a support class that decodes/encodes the form data from/to JSON, since that will ease your client-side implementation (and potentially streamline the volume of data passed).  See the conversation here at <a href="https://stackoverflow.com/questions/1019223/any-good-libraries-for-parsing-json-in-classic-asp">Any good libraries for parsing JSON in Classic ASP?</a></p>\n\n<p>Lastly, at the client-side, provide a method that takes a Verb, Url and data payload.  In the short-term the method will collate the parameters and forward them to your landing pad.  In the longer term (once you switch away from Classic ASP) your method can send the data to the \'real\' url.</p>\n\n<p>Good luck...</p>\n'}, {'answer_id': 47422679, 'author': 'grahamesd', 'author_id': 441729, 'author_profile': 'https://Stackoverflow.com/users/441729', 'pm_score': 1, 'selected': False, 'text': "<p>Another possible solution is to write a .NET DLL that makes the calls and returns the results (maybe wrap something like RESTSharp - give it a simple API customized to your needs). Then you register the DLL as a COM DLL and use it in your ASP code via the CreateObject method.  </p>\n\n<p>I've done this for things like creating signed JWTs and salting and hashing passwords. It works nicely (while you work like crazy to rewrite the ASP).</p>\n"}]
['https://Stackoverflow.com/questions/11219', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/160/']