Write a separate Web Service for Delphi7 (step)

zhaozj2021-02-11  183

I saw a good article early in the morning, and it was tied to the following steps.

1 Create a SOAP Server Application, enter myHello when prompted to enter the interface, put all files

Save in a directory called Series, one of the files containing TwebModule1 saved as main.pas.

Add to ImyHello interface in MyHelloinTf.Pas

Function Welcome: String; stdcall;

This method implements this method in the TMYHELLO in MyHelloImpl.PAS

Function TMYHELLO.WELCOME (name: string): String;

Begin

Result: = 'Welcome' Name;

END;

2 Create a standard Application to save all files under Which SER directory (the same directory).

File name default, UESE IDHTTPWEBBROKERBRIDGE in Unit1.PAS, may also be in the project

Search path Add / source / inde is the installation directory of Delphi

3 Put a Lable on Form1, write "Stand Alone Web Service"

4 Add a variable SER: TIDHTTPWEBBROKERBRIDGE; TIDHTTPWEBBROKERBRIDGE

Main.pas myhellointf.pas myhelloimpl.pas in the first step 5USES

7 Write on the onFormCreate event

Ser: = TidHttpwebBrokerbridge.create (Self);

SER.DEFAULTPORT: = 5678;

SER.ACTIVE: = True;

Ser.RegisterWebmoduleClass (TWEBModule1);

8 Run the program, open IE, type http: // localhost: 5678 /. Everyone thinks

Write Client

1 Turn off all files.

2 New standard Application

3 Run the server that just written, Application

4 Run WSDL Import Wizard, type http: // localhost: 5678 / WSDL / IMYHELLO in the URL

Press next to NEXT

5 Save all files to a new directory, save the file generated by Wizard to ImyHello1.PAS, the rest of the default, in Unit1.PAS

Imyhello1.pas, put a TButton, write the code below, run.

Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);

VAR

I: iMyhello;

Begin

I: = getimyhello;

ShowMessage (I.welcome);

I: = nil;

END;

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

New Post(0)