当前位置: 首页 > news >正文

宜春网站建设哪家专业/技能培训网

宜春网站建设哪家专业,技能培训网,网站代码开发,网络工作室视频新建一个工程。选择如图。继续输入服务名然后就生成对应的单元。增加linux 平台。完善对应的单元代码{ Invokable implementation File for Txaliontest which implements Ixaliontest }unit xaliontestImpl;interfaceuses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns…

新建一个工程。选择如图。

继续输入服务名

然后就生成对应的单元。

增加linux 平台。

完善对应的单元代码

{ Invokable implementation File for Txaliontest which implements Ixaliontest }unit xaliontestImpl;interfaceuses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns, xaliontestIntf;type{ Txaliontest }Txaliontest = class(TInvokableClass, Ixaliontest)publicfunction echoname(const Value:string):string; stdcall;function sumall(const Value:integer):integer; stdcall;end;implementation{ Txaliontest }function Txaliontest.echoname(const Value: string): string;
beginresult:='你好'+value;
end;function Txaliontest.sumall(const Value: integer): integer;
vari:integer;isumall:integer;
beginisumall:=;for i :=  to value doisumall:=isumall+i;result:=isumall;
end;initialization
{ Invokable classes must be registered }InvRegistry.RegisterInvokableClass(Txaliontest);
end.
{ Invokable interface Ixaliontest }unit xaliontestIntf;interfaceuses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns;type{ Invokable interfaces must derive from IInvokable }Ixaliontest = interface(IInvokable)['{20590E4A-BF8C-41AE-A630-94D2DD38EEE1}']{ Methods of Invokable interface must not use the default }{ calling convention; stdcall is recommended }function echoname(const Value:string):string; stdcall;function sumall(const Value:integer):integer; stdcall;end;implementationinitialization{ Invokable interfaces must be registered }InvRegistry.RegisterInterface(TypeInfo(Ixaliontest));end.

编译本工程。出错了?

不要害怕,这是因为linux 上apache的引用没有加入。我们确认apache 已经在linux上安装成功。

那么我们在IDE 里面处理一下。

记住设以上的地方为True, 允许未定义的引用。

现在重新编译

OK 了

现在的任务就是在发布这个apache 模块。

这一块的内容请参照前面的文章。

配置文件如图:

启动apache.

在浏览器里面输入对应的地址,就可以显示webservice 的接口信息了。

好了,服务端搞定了。我们做一个客户端来调用一下这个服务。

直接建一个vcl application .

然后选择WDSL 导入器。

输入对应的地址。

系统会生成对应的接口文件

// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://192.168.1.66/xalionws/wsdl/Ixaliontest
// Encoding : utf-8
// Version  : 1.0
// (2017-4-8 21:33:51 - - $Rev: 90173 $)
// ************************************************************************ //unit Ixaliontest1;interfaceuses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;type// ************************************************************************ //// The following types, referred to in the WSDL document are not being represented// in this file. They are either aliases[@] of other types represented or were referred// to but never[!] declared in the document. The types from the latter category// typically map to predefined/known XML or Embarcadero types; however, they could also// indicate incorrect WSDL documents that failed to declare or import a schema type.// ************************************************************************ //// !:int             - "http://www.w3.org/2001/XMLSchema"[]// !:string          - "http://www.w3.org/2001/XMLSchema"[]// ************************************************************************ //// Namespace : urn:xaliontestIntf-Ixaliontest// soapAction: urn:xaliontestIntf-Ixaliontest#%operationName%// transport : http://schemas.xmlsoap.org/soap/http// style     : rpc// use       : encoded// binding   : Ixaliontestbinding// service   : Ixaliontestservice// port      : IxaliontestPort// URL       : http://192.168.1.66/xalionws/soap/Ixaliontest// ************************************************************************ //Ixaliontest = interface(IInvokable)['{A3FB1A48-1AE7-B449-16DC-42CCE1A48832}']function  echoname(const Value: string): string; stdcall;function  sumall(const Value: Integer): Integer; stdcall;end;function GetIxaliontest(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): Ixaliontest;implementationuses System.SysUtils;function GetIxaliontest(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): Ixaliontest;
constdefWSDL = 'http://192.168.1.66/xalionws/wsdl/Ixaliontest';defURL  = 'http://192.168.1.66/xalionws/soap/Ixaliontest';defSvc  = 'Ixaliontestservice';defPrt  = 'IxaliontestPort';
varRIO: THTTPRIO;
beginResult := nil;if (Addr = '') thenbeginif UseWSDL thenAddr := defWSDLelseAddr := defURL;end;if HTTPRIO = nil thenRIO := THTTPRIO.Create(nil)elseRIO := HTTPRIO;tryResult := (RIO as Ixaliontest);if UseWSDL thenbeginRIO.WSDLLocation := Addr;RIO.Service := defSvc;RIO.Port := defPrt;end elseRIO.URL := Addr;finallyif (Result = nil) and (HTTPRIO = nil) thenRIO.Free;end;
end;initialization{ Ixaliontest }InvRegistry.RegisterInterface(TypeInfo(Ixaliontest), 'urn:xaliontestIntf-Ixaliontest', 'utf-8');InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Ixaliontest), 'urn:xaliontestIntf-Ixaliontest#%operationName%');end.

在主窗体放两个按钮。

implementation{$R *.dfm}uses Ixaliontest1;procedure TForm2.Button1Click(Sender: TObject);
beginshowmessage(  GetIxaliontest.echoname('xalion'));
end;procedure TForm2.Button2Click(Sender: TObject);
beginshowmessage(  GetIxaliontest.sumall().tostring);
end;

http://www.jmfq.cn/news/5336803.html

相关文章:

  • 双牌网站建设/二级网站怎么做
  • 网站建设微企/公司网络推广方法
  • 网站建设推广途径/大型网站建设平台
  • 温岭网站建设/网络营销费用预算
  • 磐石市住房和城乡建设局网站/sem是什么意思中文
  • 中国建设银行官网站账户商品/开平网站设计
  • 东莞网站建设优化东莞/小红书关键词排名怎么做
  • 市住房城乡建设委网站/搜索引擎网站排名优化方案
  • 项目网站建设应入哪个科目/新闻热搜榜 今日热点
  • 科技杭州网站建设/网站关键词
  • 深圳企业医疗网站建设/如何查询网站收录情况
  • 二手车网站建设意见/关键词挖掘排名
  • 网站建设结构方案/站长工具app下载
  • 企业网站建设的成本/网盘资源
  • 网站建设新闻网站/在线培训系统平台
  • 花卉网站建设规划书/平面设计
  • 网站建设学生选课系统设计/暴风seo论坛
  • 网站建设包含的费用内容/搜索引擎怎么做
  • 建设网站如何给页面命名/抖音竞价推广怎么做
  • 网站建设需要哪些材料/seo舆情优化
  • 广东建设信息网是什么网站/乔拓云智能建站平台
  • 加强和改进校园网站内容建设/谷歌商店paypal下载官网
  • 网站建设 电脑 手机/seo优化搜索结果
  • 移动网站建设商/学生个人网页制作成品代码
  • 莞城微网站建设/seo都用在哪些网站
  • 河南省建设人才信息网站/优秀的网页设计网站
  • 中山网站建设文化平台/杭州优化外包哪里好
  • 保定市住房和城乡建设局网站/互联网广告平台代理
  • 网站建设资讯平台/职业技术培训
  • 淄博网站建设找卓迅/福州网站排名