简体   繁体   English

用于Delphi XE的SOAP服务器和客户端应用程序VCL + indy演示?

[英]SOAP server and client application VCL+indy demo for Delphi XE?

Delphi used to include a demos folder for web Services, but no longer seems to include this. Delphi过去常常包含一个用于Web服务的demos文件夹,但似乎不再包含这个。

I just tried the Delphi 7 demo projects ( SOAPDMServerWAD , a server with almost no UI at all, and SOAPDMClient ) and was unable to get them to function, even in Delphi 7. 我刚刚尝试了Delphi 7演示项目( SOAPDMServerWAD ,一个几乎没有UI的服务器,以及SOAPDMClient ),即使在Delphi 7中也无法使它们运行。

If anybody has ever made a similar demo work in Delphi XE, or Delphi 2010, identical to the old SOAPDMServerWAD+SoapDMClient demos, working in Delphi XE, and with at least the minimal UI that comes from the Delphi SOAP Server application wizard, that would be perfect. 如果有人在Delphi XE或Delphi 2010中做过类似的演示工作,与旧的SOAPDMServerWAD+SoapDMClient演示相同,在Delphi XE中工作,并且至少具有来自Delphi SOAP Server应用程序向导的最小UI,那就是完美。

Update: The demo appears all the way up to Delphi 2010 but uses the now-obsoleted WAD (web-app-debugger), I tried to port it to the new Indy runtime/web-app-development-harnessing-code , but I can't seem to get it working. 更新:演示一直到Delphi 2010,但使用现已废弃的WAD(web-app-debugger),我尝试将其移植到新的Indy runtime/web-app-development-harnessing-code ,但是我似乎无法让它发挥作用。 The demo runs, but the server has no User interface, and does not appear to be running any HTTP server (tested using a regular web browser, via http://localhost:port/ urls. By the way, try googling for a demo, and this url comes up, and I asked less than an hour ago. That's scary, google. 演示运行,但服务器没有用户界面,并且似乎没有运行任何HTTP服务器(使用常规Web浏览器测试,通过http://localhost:port/ urls。顺便说一下,尝试谷歌搜索演示,这个网址出现了,不到一个小时前我就问了。这太吓人了,谷歌。

Update2 See my own answer below, a link is coming soon with working code. Update2请参阅下面的我自己的答案,工作代码即将推出一个链接。

I have posted the complete set of demos for SOAP on CodeCentral as item 28789 . 我已经在CodeCentral上发布了完整的SOAP演示集, 作为项目28789

These contain every single one of the Delphi 2007 era SOAP demos from the WebServices folder, now updated for Delphi XE and XE2, including converting the old WAD servers into new INDY VCL servers. 这些包含来自WebServices文件夹的Delphi 2007时代SOAP演示中的每一个,现在已针对Delphi XE和XE2进行了更新,包括将旧的WAD服务器转换为新的INDY VCL服务器。 You'd think that was impressive, except it's not. 你认为这是令人印象深刻的,除非它不是。 It's really easy. 这真的很容易。 Just use the wizard to create a new project, and then add the web service interface and implementation units, and any other units that belong in the old demo, to the project. 只需使用向导创建一个新项目,然后将Web服务接口和实现单元以及属于旧演示的任何其他单元添加到项目中。 Once they're added to the project, they just work. 一旦他们被添加到项目中,他们就会工作。 Basic demo SOAP Servers are really easy to build in Delphi, once you have a working demo, you'll find it's pretty easy to modify and extend it. 基本演示SOAP服务器在Delphi中很容易构建,一旦你有一个工作演示,你会发现很容易修改和扩展它。

The demo that best answers the question I asked above is in the SOAPDataModule sub-folder. 最能回答我上面提到的问题的演示是在SOAPDataModule子文件夹中。

The basic problems with the demo from the 2007 era are two: 2007年时代演示的基本问题有两个:

  1. The WAD (web app debugger) is gone. WAD(Web应用程序调试器)消失了。 you have to make a new server using the Indy server, for optimal demo purposes, saving you from using WAD (which is gone) or setting up ISAPI environment, under IIS, which is hardly ideal for demo purposes. 为了获得最佳演示目的,您必须使用Indy服务器创建一个新服务器,以免在IIS下使用WAD(已经消失)或设置ISAPI环境,这对于演示目的来说并不理想。 The new demo project I made is called SoapDMServerINDY , and it consists of a data module (datamod_u.pas), a VCL form User Interface unit ( IndyServerVCLFormUnit.pas ) and an Indy Server web module, called IndyServerWebModule.pas . 我制作的新演示项目名为SoapDMServerINDY ,它由数据模块(datamod_u.pas),VCL表单用户界面单元( IndyServerVCLFormUnit.pas )和Indy Server Web模块(称为IndyServerWebModule.pas

  2. The Delphi 2007 demo broke thanks to the new practice of having a Debug/Win32 subfolder that the demo executable is now in, you need to go up further. Delphi 2007演示破解了由于具有现在演示可执行文件的Debug / Win32子文件夹的新实践,您需要更进一步。 I fixed the demo server so that it warns you with an error message if the data files cannot be located, saving you from the mysterious "XML parsing error". 我修复了演示服务器,以便在无法找到数据文件时向您发出错误消息警告,从而避免了神秘的“XML解析错误”。 I also added some error checking in a few of the demos so that it tells you that you need to install interbase for this demo to work, since some of the demos require Interbase installed and running, and one requires an alias called IBLOCAL to exist, and preferably a table called EMPLOYEE to exist. 我还在一些演示中添加了一些错误检查,以便它告诉您需要安装interbase以使此演示工作,因为一些演示需要安装并运行Interbase,并且需要存在名为IBLOCAL的别名,并且最好存在一个名为EMPLOYEE的表。

在此输入图像描述

The elements of this demo are a server ( SoapDMServerINDY , based on the code from SOAPDMServerWAD), and the client SOAPDMClient which connects to the demo and has two pages, one page will show basic data access via a DBGrid + dataset remoting, and the second page shows how to invoke a custom SOAP method. 这个演示的元素是一个服务器( SoapDMServerINDY ,基于来自SOAPDMServerWAD的代码),以及客户端SOAPDMClient连接到演示并有两个页面,一个页面将通过DBGrid +数据集远程显示基本数据访问,第二个页面将显示该页面显示了如何调用自定义SOAP方法。

To use the demo: You have to start the server, click the start button, then start the client and click Connect. 要使用演示:您必须启动服务器,单击开始按钮,然后启动客户端并单击连接。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM