我已在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/