Delphi 6 Preematch - BizsnapSOAPWebService 3 - implement three-layer database application with SOAP

zhaozj2021-02-08  243

Delphi 6 preemptive study - Bizsnap / SOAP / WebService

- Implement three-layer database application with SOAP

In the previous example (see "Delphi 6 preemptive research - one of BizSnap / SOAP / Webservice - an example of Hello World! And" Delphi 6 preemptive research - BizSnap / SOAP / WebService 2 - Delivery through SOAP We see the powerful function of SOAP, especially the second example. As shown in the previous example, we use the MIDAS / DATASNAP's Provide / Resovle architecture to make a Data / Delta package to deliver a three-layer database application through SOAP between Web Services and clients. This is a way, but it is not afraid to have trouble, in fact, Delphi 6 has already prepared for us, and she is doing better, she makes the Iappserver interface SOAP package, so that we can use the same way as Midas / DataSnap to develop based SOAP multi-layer database application. Of course, it will still be described in an example: server: 1.New | Webservices | SOAP Server Application, as shown below: This time we use Web App Debugger (see "Delphi 6 Preferred Research - Web App Development and Debug"), set Its coclass name is WadsoapDemo3, as shown below: 2. SaveAll, Unit2 named: svrwmmain, Unit1 does not change the name, project1 named: demo3; 3.new | WebServices | SOAP Server Data Module, Enter: Enter the pop-up Class Name is SOAPDemo3DM, as shown below: After confirming this unit as svrdmsoap; 4. Put three controls in SoapDemo3DM: SQLConnection1, SqlDataSet1, DataseTProvider1, as shown below: Its property is set to:

SqlConnection1ConnectionName: = iblocal; loginprompt: = false; params.values ​​['Database']: = '[...] / example / database / employee.gdb'; // above [...] is installed for your interbase path SQLDataSet1SQLConnection: = SQLConnection1; CommandText: = 'select EMP_NO, FULL_NAME, PHONE_EXT from EMPLOYEE'; DataSetProvider1DataSet: = SQLDataSet1; 5. service side so complete, without writing a single line of code, compile and run, then exit to complete the Web App Debugger Application for the application. Start the web app debugger, then start the browser, enter the address bar: http: // localhost: 1024 / demo3.wadsoapdemo3 / wsdl to see three interfaces:

Port TypeNamespace URIDocumentationWSDLIWSDLPublishurn: WSDLPub-IWSDLPublishWSDL for IWSDLPublishIAppServerurn: Midas-IAppServerWSDL for IAppServerISoapDemo3DMurn: SvrDMSoap-ISoapDemo3DMWSDL for ISoapDemo3DM which in addition to the interface ISoapDemo3DM have DataModule, the most important thing is more than a IAppServer interfaces, as long as this interface, there is Midas / Datasnap. Next to the client: 1.New | Application Create a new general VCL application; 2.saveall, unit1 named clnmain, Project1 named client; 3. Put SOAPConnection1 on Form1 (the last one in the WebService page), ClientDataSet1, Datasource1, DBNAVigator1, Button1, DBGRID1, etc. /demo3.wadsoapdemo3/soap '; ClientDataSet1RemoteServer: = SoapConnection1; ProviderName: =' DataSetProvider1 '; Active: = true; DataSource1DataSet: = ClientDataSet1; DBNavigator1DataSource: = DataSource1; DBGrid1DataSource: = DataSource1; Button1Caption: =' Apply '; 4. Double- Button1 Enter the following program: Procedure TFORM2.BUTTON1CLICK (Sender: TOBJECT);

Begin

ClientDataSet1.ApplyUpdates (-1);

END;

5. At this point, the client program is also completed, compiled and running (determine the web app debugger is running), you can see the server runs for a while, its form flashes a few seconds, the client program can get the data and display it. . The data can now be operated by dbnavigate / dbgrid. After the operation is complete, press the Apply button to submit a data modification to the server, which will run the server program. In this way, we only wrote a line of procedures to complete a SOAP-based multi-layer database application. Http://msrc.126.com Raptor Oct.20-01

转载请注明原文地址:https://www.9cbs.com/read-2634.html

New Post(0)