Delphi c#Webservice SOAP请求缺少参数值

问题描述 投票:1回答:1

我需要在Delphi7中的客户端和.NET Web服务(ASMX)之间实现SOAP通信。我知道很旧的项目/技术。

我已经编写了Web服务,但是通过WSDL Importer(基于THTTPRIO)自动创建的类无法正常工作,我无法将参数值传递到Web服务中。换句话说,将调用webservice中的method,但是其所有参数都具有默认值。我可以自己解析xml请求,但是在WebMethod中无法访问原始xml。我希望,我只是缺少一些方法属性。有什么主意吗?

我使用网络嗅探器确保将参数发送到服务,如下所示:

POST /Lib/ASPX/WSService.asmx HTTP/1.1
SOAPAction: "WS/GetMessages"
Content-Type: text/xml
User-Agent: Borland SOAP 1.2
Host: localhost:54561
Content-Length: 480
Connection: Keep-Alive
Cache-Control: no-cache

<?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:GetMessages xmlns:NS1="WS">
<id xsi:type="xsd:int">12345</id>
</NS1:GetMessages>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

以及webservice中方法的标头,使用参数id = 0进行调用

[WebMethod]
public List<HelpDeskView> GetMessages(int id) 
c# web-services soap delphi-7
1个回答
0
投票

我已经找到解决方案。在自动生成的单元末尾的initialization部分中,缺少此行:

InvRegistry.RegisterInvokeOptions(TypeInfo(Service1Soap), ioDocument);
© www.soinside.com 2019 - 2024. All rights reserved.