? Delphi Development WebService to ASP.

Source: Internet
Author: User

Delphi Development WebService to ASP .

Description

1 , this document is divided into 3 sections, respectively:

Using Delphi to write WebService

Deploying WebService under IIS

Calling WebService in ASP.

2 , development environment for Windows XP SP2, Delphi 7.0, IIS 5.1, VS (C #)

First, using Delphi to write WebService

1th Step: File→new→other→webservices→soap Server Application

2nd step: Choose Isapi/nsapi dynami Link Library

3rd Step: Select Yes

4th step: Enter the name of the interface, here with main, other options do not change, click OK

5th step: Open the project manager, then open the Mainintf.pas file, Mainintf.pas is the interface definition unit


6th step: Define a sum function in Mainintf.pas, the function of which is to calculate and display 2 integers, as shown in the red box


7th step: Open the Mainimpl.pas file, Mainimpl.pas is the interface implementation unit. Implement the SUM function in this cell


8th Step: Open Project manager, compile Project1.dll


Ii. Deploying WebService under IIS

1th Step: Open IIS Manager with the inetmgr command

2nd Step: Right-click on the default website as shown, then create new → virtual directory

3rd Step: Click Next

4th step: Virtual Directory alias, enter WebService here, click Next

5th step: Output Directory, we recommend the use of "C:\Inetpub\wwwroot", "C:\Inetpub\wwwroot" This directory in the 8th step will be used. Click Next

6th step: Access rights, tick "execute (such as ISAPI reference Program live CGI)", this is important, be sure to tick , then click Next

7th step: Click Finish, you can see the WebService virtual directory in IIS Manager

8th step: Copy the Project1.dll to the C:\Inetpub\wwwroot directory, if prompted Project1.dll is occupied, you can forcibly end the Dllhost process in the Task Manager and then copy, as shown in

9th step: Enter http://localhost/webservice/Project1.dll This URL in the browser, if display the following page, explain WebService available.

If you click [WSDL] next to "Imain" in the page, the browser jumps to

Http://localhost/webservice/Project1.dll/wsdl/IMain ,

We'll use this URL next.

Iii. calling WebService in ASP.

1th Step: Open VS2008, file → new → website

2nd step: Select the ASP. Language is C #, click OK

3rd Step: Solution Explorer, right click, select "Add Web Reference"

4th step: Enter in the URL

Http://localhost/webservice/Project1.dll/wsdl/IMain then click "Go"

5th step: Web reference name, you can use the default value, point "add Reference"

6th step: Double-click "Default.aspx" and then double-click "Default.aspx.cs"

7th step: Add the following code to the "Default.aspx.cs" code window on the left, as shown in the red box

8th step: Press CTRL+F5 to run, the correct display page is as follows


? Delphi Development WebService to ASP.

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.