Delphi WebService Authoring, debugging, Publishing (IIS), calling

Source: Internet
Author: User
Tags wsdl

The following describes how to write WebService for an ISAPI type for IIS publishing.
1, new| other| webservices| The SOAP Server application| first chooses to build the web App Debugger
Type of webservice, because this type of webservice is easy to debug when we debug it, ready to release and then
This type is converted to an ISAPI type.
2, choose the Web App debugger, enter a classname, here we enter "Test"
3, then Delphi will ask you whether to establish the interface unit, select Yes, and then enter the name of the interface, we enter Main,
Delphi will automatically establish the interface unit (the name of the interface name you entered +intf end, that is, mainintf) and implement the interface of the single
Meta (name is the interface name you entered +impl, i.e. Mainimpl). To this an empty webservice has been set up well.
4. Next, we will write the WebService function for others to call. Here we write a simple example. Open the interface unit
(mainintf), after the type, the interface declaration is added after the interface function
"Function getmsg (amsg:string): string; stdcall, "stdcall" must be appended to the function.



5, the interface function declaration has been completed, the following is to implement this function. Open the Interface Implementation Unit (MAINIMPL),
Write the declaration of the function in public and write the implementation of the function after implement.

6, to this, WebService has been written completed. The next step is debugging. In our new building, Delphi has been
A Unit1 and its form are established, the interface Unit (MAINIMPL) is referenced in the Unit1, and the form is added with a
button, in the Click event of the button to invoke the WebService function just written can be debugged, 7, after the successful debugging can be converted to type, the Web App debugger type to the ISAPI type is actually very simple, we
First re-build an ISAPI-type WebService project, select new| other| webservices|
SOAP Server application| ispa/., if you are prompted to select "Yes" when creating the interface, then enter and
Type of interface name, then save well, and then debug the successful Web App debugger in the WebService project of the
Interface units and interfaces implement unit replication to replace the interface unit and interface implementation units in the ISAPI type project that you just created.
Then open the WebService of the ISAPI type and compile the build DLL. The webservice of the ISAPI type has been successfully established.

8. Publish the WebService of the ISAPI type to IIS. Create a new site in IIS and set the Execute permission to "script
and executables, copy the WebService entire project to the site folder and start the site, which webservice even
The publication succeeds if IIS is more than 6.0 aware that the "all unknown ISAPI extension" is set to allow in the Web service extension,
Specific settings can be found in the IIS Help documentation.


9, how to use Delphi to invoke the WebService just written. In the browser, enter the path of the site just now, such as:
Http://192.168.1.5:90/, the browser goes to the folder where the project is located,

Click Bin, open the generated DLL folder, click the generated DLL file, open the DLL description page as shown,
There are three interface functions hz,lj,savedata in the DLL, all of which are interface functions for others to call.

Click on the WSDL to open the WSDL description page, at this time copy the page URL, this URL is what we need to use.

10, get the URL, create a new application, we are in this application call just the webservice.
Click new| other| webservices| WSDL import, as prompted to enter the URL, we entered just copied the
URL, click Next,finish, this time Delphi will automatically add a unit, the cell is called WebService
Unit, we can call WebService with this unit. Reference the cell in Unit1, and then add a button,
Declare an interface object in the Click event of the button, and then call the getmainintf in the auto-generated cell (the method is
The auto-generated function assigns a value to the interface object, and can then invoke the interface function with the interface object.

Delphi WebService Authoring, debugging, Publishing (IIS), calling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.