Now that the Web service has become more and more fire, in dotnet developed Web service, Delphi 7 how convenient to call dotnet write Web service.
There are two ways in which the Wsdlimp tool translates dotnet-written Web service into interface cell files in Delphi 7, and the Microsoft Soap Toolkit (MSST) tool provided by Ms.
Here's a simple Web Service called C # with the Wsdlimp tool:
Start VS. Net tools, in a C # project, select the ASP.
[WebMethod]
Public double Add (double S1, double s2)
{
return s1+s2;
}
After creating the accessory, enter http://localhost/ASPNETWS/Service1.asmx in IE
You will see an Add link, click Enter, and call the test:
For example, the input S1 is S2, and after 235.34 is called
<?xml version= "1.0" encoding= "Utf-8"?>
<double xmlns= "http://tempuri.org/" >269.34000000000003</double>
Enter Http://localhost/ASPNETWS/Service1.asmx?WSDL to see the WSDL unit
After the test is successful, find the WSDLImp.exe tool in the Bin Directory of Delphi 7 and copy it to a place
At the command prompt, enter Wsdlimp Http://localhost/ASPNETWS/Service1.asmx?WSDL
A Service.pas file is generated in the current directory, which is the interface file to be used in Delphi.
Start Delphi 7, create a new application project and put in a TButton component;
Added Invokeregistry, Rio, Soaphttpclient, Service1 in uses;
Procedure Tform1.btn_cshapwsclick (Sender:tobject);
Var
wsresult:double;
Wsiserver:service1soap;
Begin
Wsiserver:= Getservice1soap (True, ', HTTPRIO1);
wsresult:= Wsiserver.add (23,342.234);
ShowMessage (' WSResult: ' + floattostr (WSResult));
End
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