--->> The code for this article can be downloaded here.
I think he was wanting the code at the end of the link.
David Moorhouse wrote:
HTH
Cheers
D
Building a stand-alone Web service with Indy
Abstract: This article shows how to build a Web service using Indy and
Delphi 6. By Dave Nottage.
This article explains how to fit Indy into Delphi 6's Web services (SOAP)
support. For more on creating Web services, please refer to Nick Hodges's
excellent Borland Community article, Shakespeare on the Web.
I can't remember exactly why I built the application that follows. For
whatever reason, I needed to find an easy way of building a stand-alone Web
service -- that is, one that doesn't require a Web server.
A recent post in the borland.public.delphi.webservices.soap newsgroup and a
gentle hint from elsewhere have prompted me to drag out the code, clean it
up, and brush a few of the cobwebs out of my head. This article is the
result.
Fitting Indy into WebBroker
The components in Delphi 6's SOAP support are based around WebBroker.
Typically in a WebBroker application, a component that implements
IWebDispatch lives on a TWebModule. In the case of a SOAP server, it's
THTTPSoapDispatcher:
SOAP Web Module
The major goal here was to leave as much of this default arrangement intact
as possible. So instead of attempting to fiddle with the SOAP components, I
stuck with WebBroker.
Looking at the WebBroker architecture, I noted that the underlying
technology is independent of the type of application. ISAPI, CGI, whatever
-- it doesn't matter. The basic principles are the same: You have a request
from the client (TWebRequest) and a response from the server
(TWebResponse).
Indy's Request/Response mechanism of TIdHTTPServer is similar, so I figured
I could simply create wrapper classes similar to those used in ISAPI and
CGI applications, and hook them into the CommandGet method of TIdHTTPServer
so requests would be handled.
The result is the code in IndyApp.PAS and IndyHTTP.PAS (which correspond to
xxxApp and xxxHTTP for ISAPI, CGI, COM, and son on). Note that not all of
the methods of TWebRequestIndy and TWebResponseIndy have complete
implementations. Perhaps someone with more knowledge of Indy than I have
can finish it off. <g>
Turning a WebAppDebugger app into Indy
Since there is no "Indy SOAP Server Application" wizard (perhaps I'll find
time to build one later), and the aim was to create a stand-alone
executable, the most logical choice was to start with the SOAP Server
Application wizard (File | New | Other, WebServices tab, SOAP Server
Application):
Gallery - Web Services
...and choose Web App Debugger executable. That's just what I did. I used a
dummy CoClass name, because the code generated for it would be removed
later:
New SOAP Server
In the main form unit's implementation:
unit Unit1;
interface
uses
SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ComApp;
{$R *.DFM}
const
CLASS_ComWebApp: TGUID = '{44139136-EFD0-4044-8A3C-13484508A833}';
initialization
TWebAppAutoObjectFactory.Create(Class_ComWebApp, 'Dummy', 'Dummy
Object');
end.
I removed the uses clause, the CLASS_ComWebApp const, and the
initialization section. The conditional define: {$APPTYPE GUI} was not
required, so that was removed also. In the uses clause, I changed COMApp to
IndyApp, and the DefaultPort property was set to what I wanted (1024)
before Application.Initialize, with Active set to true once the main form
had been created.
Service, please
Using the Invokable Wizard (which I co-authored with Borland), I created a
simple interface and invokable class. The implementation unit (DemoImpl)
was added to the project's uses clause (to make sure that the invokable
class is registered when the app runs), and I was away!
I ran the app, pointed my browser at http://localhost:1024/wsdl/IDemo, and
lo and behold, the WSDL was published!
Thanks to my hours of blood, sweat and tears, you too can have your own
stand-alone Web service application, all without the aid of .NET -- or even
a Web server.
Refer to Nick Hodges's article for advice on how to create a Web service
client to access the Web service.
The code for this article can be downloaded here.
Dave Nottage is CEO of Pure Software Technology, a software development
company specializing in Delphi. He can be reached at [EMAIL PROTECTED] and the
company's website is http://www.puresoftwaretech.com
Published on: 8/17/2001 12:00:00 AM
On Tue, 04 Dec 2007 09:14:06 +1300, you wrote:
Hi
I am looking at writing a standalone SOAP server using INDY and Delphi
2007. I have been looking for some examples / guides and not found much
(any pointers would be appreciated). However I have found an example on
the codegear site but I just cannot download it. Whenever I click it it
asks me to log in (which I am). Trying to log in again just leaves me
on the log in page. Could someone pleeeeaassee try and download this
for me (and email it through to me).
The Link is http://dn.codegear.com/article/27513 (There is a 'here'
link at the bottom of the page.
Thanks V Much
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe