web-services - 调用Web服务并在Delphi 7中返回错误

标签 web-services delphi wsdl delphi-7 delphi-xe5

我已在Delphi 7中导入WSDL并在其上调用一个函数,将显示错误消息:

项目Project1.exe引发异常类ERemotableException,并显示消息“服务器无法处理请求。 --->对一个或多个实体的验证失败。有关更多详细信息,请参见“ EntityValidationErrors”属性。进程已停止。使用“步骤”或“运行”继续。



当我调用WebService方法(在Delphi 7中)时,使用Fiddler软件,我得到了消息内容(XML):

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:Save xmlns:NS1="http://tempuri.org/"><from xsi:type="xsd:string">1</from><to xsi:type="xsd:string">2</to><body xsi:type="xsd:string">ServiceTest</body></NS1:Save></SOAP-ENV:Body></SOAP-ENV:Envelope>




然后,我在Delphi XE5中正确地调用了相同的方法和Web服务,并且没有出现以下XML内容:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><Save xmlns="http://tempuri.org/"><from>1</from><to>2</to><body>ServiceTest</body></Save></SOAP-ENV:Body></SOAP-ENV:Envelope>


SOAP服务器响应:


在.NET框架中编写SOAP Web服务并支持SOAP 1.1和1.2

有任何想法吗?

最佳答案

我已经使用THTTPRIO.OnBeforeExecute来更改SOAPResponse。然后删除不必要的属性并输入XML源并再次打包并将其分配给SOAPResponse并发送它。

用这种方法解决了问题。

关于web-services - 调用Web服务并在Delphi 7中返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30029759/

相关文章:

java - Spring Controller 重定向到另一个模块

.net - 记录 ASP.NET MVC 性能指标

ios - 控件变得不可见 - 如何修复奇怪的 GUI 行为 - Delphi xe6

java - 无法从 WSDL 生成 stub /java 骨架

c# - 如何从 C# web 服务生成 WSDL 文件

javascript - 如何使用 Express.js 处理空 URL 参数

delphi - Delphi有 "mind mapping"组件吗? (最好是原生VCL)

delphi - 虚拟 TreeView 拖动

PHP/SOAP : How can UserCredentials be passed to SOAP request?

java - 从 java 应用程序抛出 WebServiceException