Delphi7快速調用C#做的web services

來源:互聯網
上載者:User

怎麼實現不同平台之間的web service?下面是我用Delphi7調用C#做的web services的過程:
(1),在vs2005建立asp.net web 服務,系統自動產生一個返回字串("helloworld")的服務。
(2)開啟delphi7,建立一個工程,儲存,再開啟File||New||Other||Webservices||WSDLImporter,按照步驟建立一個Service,儲存。注意添加服務時後加?wsdl:

(3)在Unit1.pas的uses裡添加服務名(如:Service),form1上添加button,text.box,和(web services),設定該控制項屬性,

(4)寫button單擊事件,代碼如下:

procedure TForm1.Button1Click(Sender: TObject);
var
a:ServiceSoap;
begin
 a:=HTTPRIO1 as ServiceSoap;
 edit1.Text:=a.HelloWorld;
end;

(5)現在可以運行看到text.box裡出現服務返回的字串了 。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.