Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(二)
来源:互联网 发布:淘宝前100名半价怎么抢 编辑:程序博客网 时间:2024/04/30 03:31
确保之前的MySOAPServer.exe已经运行,在IE中打开地址http://localhost:1024/wsdl/IMySOAPWebService进行确认。
点击菜单File --> New --> Application,在窗体从标准控件中上放一个Button,一个Label,从WebServices控件中放一个HTTPRIO到窗体上。
排列一下Button1与Label1的位置,让它看起来漂亮一点。
点击菜单View --> Project Manager打开项目管理器,展开Project(n).exe目录
展开Unit1,双击Form1,按F11激活对象观察器,将Name属性由Form1改为MySOAPClientForm。
点击菜单File --> New --> Other,选WebServices标签,选中WSDL Importer图标,点OK
在WSDL Import向导窗口中输入WSDL文件的URL:http://localhost:1024/wsdl/IMySOAPWebService
然后点击下一步,最后点击Finish.
点击菜单View --> Project Manager打开项目管理器,双击Unit1.pas,在interface部分uses单元IMySOAPWebService1
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IMySOAPWebService1;
点击菜单View --> Project Manager打开项目管理器,双击MySOAPClientForm,选中HTTPRIO1对象,按F11激活对象观察器
对于 WSDLLocation属性,从下拉列表中选择 http://localhost:1024/wsdl/IMySOAPWebService
对于 Service属性,从下拉列表中选择 IMySOAPWebServiceservice
对于 Port 属性,从下拉列表中选择 IMySOAPWebServicePort
点击菜单View --> Project Manager打开项目管理器,双击MySOAPClientForm,再双击Button1
在 Button1Click方法中输入:
begin Label1.Caption :=(HTTPRIO1 as IMYSOAPWebService).HelloWorld('Worked!'); end;
现在你可以保存文件:
点菜单File --> Save Project As,将Unit1保存为MySOAPClientFormU.pas
IMySOAPWebService1保存为MySOAPWebServiceClientIntf.pas
Project1保存为MySOAPClient.dpr
点击菜单View --> Project Manager打开项目管理器,展开MySOAPClientForm,双击MySOAPClientFormU.pas,
将引用IMySOAPWebService1改为MySOAPWebServiceClientIntf。
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, MySOAPWebServiceClientIntf, InvokeRegistry, Rio, SOAPHTTPClient, StdCtrls;
点菜单File --> Save,保存文件。现在你可以运行程序,点击Button1调用Web Service。
- Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(二)
- Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(一)
- Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(三)
- Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(四)
- Web Services 中 Web Method 的使用小结(二)
- 使用Java SE 6 创建独立 Web Services - 服务端
- 使用Java SE 6 创建独立 Web Services - 客户端
- Web Services使用SOAP Header
- 使用 Web Services Enhancements 发送带有附件的 SOAP 消息
- 使用 Web Services Enhancements 发送带有附件的 SOAP
- 使用eclipse WTP内置的Web Services Explorer测试SOAP based Web Services
- Delphi中Indy组件的卸载方法
- Delphi 中Md5获取(Indy 9)
- Delphi 中Md5获取(Indy 9)
- 使用Soap消息调用Web Services
- 如何使用Soap消息调用Web Services
- 使用Soap消息调用Web Services
- 使用Soap消息调用Web Services
- 黑马程序员_JAVA8新特性
- LIS(最长上升子序列两种算法模板)DP模板,并且输出序列
- BM算法
- 将毫秒 换算成(天 时 分 秒 毫秒)
- 人与人相处
- Delphi 7 中使用Indy创建独立的 Web Services/SOAP 服务器(二)
- java中的数学计算函数
- 蚂蚁的难题(三)
- 微信的崛起与未来(随笔小记)
- 博客开通时刻
- spring propertyplaceholderconfigurer 讲解
- 平衡二叉树(AVL树)的实现
- Android ProgressBar ImageLoading 旋转进度值
- 【中断异常】页面异常的进入和返回