The formal proposal of SOAP should be in 1999 or 2000. At that time, when the internet started to develop, I am busy looking for work. I should not know about this noun, and I will come into contact with some three-story from Midas, COM still With Cobra, until SOAP is found, it feels that there is such a platform for such a three-layer deployment platform in the world.
Gossip, there are a few words, below the topic
If you haven't started learning SOAP, you can recommend it to write Delphi6 / Kylix2 SOAP / Web Service program design.
If you want to know the SOAP standard, you can refer to SOAP Specification.
The following starts step by step to describe how to use Delphi to create a SOAP Application for Stand Alone.
Note: The author uses Delphi7.0
If you have written or learn SOAP Application, you will say new-> web service-> soap applications, select Web App Debgger Executable, as shown below
However, this is not allowed to get the dependence on Web Server, and Delphi has very powerful indy to develop a free HTTP control for it, which can be used to publish your SOAP program.
Step 1: Create an Application
Step 2: Place some controls on the master form as shown
This example uses DBX to connect to the database, of course, you can use ADO, BDE, etc., do not write code first
Step 3: Create a SOAP Server Data Module New-> Others-> WebServices->
Establishing this Data Module to create a three-story database connection, the author defines other interfaces to Data Module for the sake of easy time (in fact, other interfaces should be implemented separately, and Data Module only implements database operations) .
Establish Data Module as follows: Name Mysoaptest, put a DataProvider.
Generate interfaces and implementations are as follows:
IMYSOAPTEST = Interface (IAPServersoAP)
['{A2F35762-FD52-44C2-9548-3B26CA5D3DD3}']
END;
TMYSOAPTEST = Class (TSOAPDataModule, IMYSOAPTEST, IAPPSERVERSERVERSOAP, IAPPSERVER)
DSAPP: TDATASETPROVIDER;
Private
public
END;
This can be written in this upper package interface or data access server.
Point DataProvider's DataSet to the Query of the main window
Then write a method TEST, you need to define in the interface part and then implement it in the implementation class.
IMYSOAPTEST = Interface (IAPServersoAP)
['{A2F35762-FD52-44C2-9548-3B26CA5D3DD3}']
Function test: string; stdcall;
END;
TMYSOAPTEST = Class (TSOAPDataModule, IMYSOAPTEST, IAPPSERVERSERVERSOAP, IAPPSERVER)
DSAPP: TDATASETPROVIDER;
Private
public
Function test: string; stdcall;
END;
Function TMYSOAPTEST.TEST: STRING;
Begin
Result: = 'Hello World';
END;
Then you need to build a soapWebmodule, but unfortunately, Delphi to 7.0 does not provide a wizard to build a SOAP webmodule, a simple method is to create a SOAP Application with Delphi, and then you will come out, add to this In Project, you do not need to write any code, as shown below: How do the server end, how to use Indy HTTP Server to publish your SOAP, you need to reference a unit, this file is /borland/delphi7/source/indy/idhttpwebbrokerbridge.pas .
Declining a server in the master Form
FSERVER: TIDHTTPWEBBROKERBRIDGE;
Write the following code in the form creation event
FServer: = tidhtpwebbrokerbridge.create (Self);
FServer.RegisterWebmoduleClass (TwmsoApindy); // This is the SOAP Web Module class
Set server port fserver.port = 1024
Then set the FServer.Active property to start or close the server
Remember Free Server, FreeAndnil (FServer);
This way, the server is completed, and then writes the client.
The client completes two work, one is to connect the server through the three-layer database client, obtain the data, and the other is the Test method to call the server.
You need to use two controls HTTPRIO and SOAPCONNECTION. It can be found in the Web Services column.
Set the URL to http: // localhost: 1024 / soap / iMysoaptest, on the client user server DATAMODULE, (in fact the correct practice is to separate the interface and importation in the server side, reference interface, put a button, the code is as follows :
ShowMessage (httprio as iMysoaptest .test);
This completes three-layer method call.
Database connections only need to drag a few controls (test premise is server launch), soapconnection-clientdata-datasource.
The above is just providing a three-story method call and database access platform, using Delphi to write more powerful applications, including the three-layer delivery of the object, I am also studying, any kind of technology is in practical application To verify its advanced nature, I hope everyone will communicate more experience.