TMS Sparkle and Intraweb


I am examining using TMS Sparkle for creating REST services to expose mu Aurelius application. I like the fact that it works on HTTP.sys so I do not have to install a webserver. However, the issue is that I have to expose some REST servers, and a web GUI from the same application.  For simplicity, I would rather use port 80 for both of them, just different URL on the same computer. 

Is there a way to "plug in" an intraweb application that it can run inside a server module for example and plug into sparkle. By default, intraweb does support ISAPI extensions.

With Sparkle you can have multiple servers or modules listening on same port and different URL's. You can have those servers running in different Windows applications (or services) or inside the same one. It's up to you. And you also can run your Intraweb application the way Intraweb allows you. As long as the IW doesn't take exclusive access to the HTTP port, you can run them simultaneously with no problem.

HI Wagner,

I guess to be more precise...

When I create an Intraweb project, it asks me to create it as a

a)standalone webserver
c) intraweb library (not sure what this is)

Do you have any example how I could take one of these projects (not the standalone webserver of course) and get it working inside a sparkle ServerModule?

To clarify, Intraweb requires to be run inside a webserver. The standalone server it provides is not for production use, just for debugging. So I would like to use Sparkle as the webserver for it, so that I do not have to deploy IIS or other webserver.

There is no way to do that, as it's Intraweb that should be "Sparkle compatible". It needs to read HTTP request information from somewhere - currently it does for Indy (standalone) and ISAPI. But it won't understand TMS Sparkle HTTP request structure. The current way is to deploy Intraweb as ISAPI and then use Sparkle as usual...

Hi Wagner,

It would be cool if you managed to make a ISAPIServerModule that translated the Sparkle HTTP request to an ISAPI request. That would open up a lot of possibilities for deploying any ISAPI compatible DLL with SPARKLE.

I'm not sure it's technically possible. What is of course possible and we might implement is create a Sparkle ISAPI Server, so you use Sparkle modules in an ISAPI module. 

But there is no way as far as I know to do the opposite: create a Sparkle server and forward the requests to a code that doesn't understand Sparkle HTTP requests. Specially with Indy/WebBroker, I'm afraid their request/response classes are not abstract enough to be created without being attached to a real HTTP/ISAPI request.

HI Wagner,
I would not worry about making a sparkle ISAPI module. Didn't you already answer to someone what we can use the webbroker solution anyhow? So that is already available.  I was just hoping to be able to host several modules (ISAPI or SPARKLE) on port 80 on the same computer without requiring an IIS installation.

Yes, but it's not 100% implemented. It's relatively easy to do so, but we are going to complete it anyway to have a plug and play solution with Web Broker.
But what you want, as I explained, is not under our control, unfortunately.

Sure, I am sure it will benefit someone.... I am still unclear though why its so difficult. When compiled as an ISAPI moduie, intraweb/Webbroker must accept some HTTP format that is coming from IIS. This must be some standard, well defined format for an HTTP request. CAn you not conver the sparkle HTTP request into an IIS/ISAPI one?

We would have to create a specific implementation of TWebRequest and TWebResponse and the worse part is that we would have to make sure Intraweb works fine with that new implementation. We don't have test cases, so it's something that will take some time to implement, and way more time to make sure it will work. It's not trivial.

I am not sure what WebRequest has to do with this. But maybe I am missing something.

I proposed that you should talk to an ISAPI extension, not to intraweb specificaally. The ISAPI interface is shown here. You can see there are just a few methods that an ISAPI DLL has to implement, the main one being HttpExtensionPro.

You would "just" need to populate a EXTENSION_CONTROL_BLOCK the same way that IIS does when calling an ISAPI. Presumably, the ISAPI DLL created by intraweb (or anyone else) knows how to take an Extension_control_block and map it to a TWebRequest, you dont have to deal with that.

The idea is that you can then host any ISAPI, not just Intraweb.

By implementing TWebRequest I can of course support any Delphi framework that is WebBroker compatible, not Intraweb.

You are asking me to implement the "IIS-side" and make Sparkle to support and load ISAPI modules. I guess this is even more complex than implementing TWebRequest!

That was the original idea. I have no idea which one is actually more complicated :-)