【发布时间】:2020-03-18 15:59:23
【问题描述】:
我需要在 Delphi7 中的客户端和 .NET Webservice (ASMX) 之间实现 SOAP 通信。非常古老的项目/技术,我知道。
我已经编写了 webservice,但是通过 WSDL Importer(基于 THTTPRIO)自动创建的类不能正常工作,我无法将参数值传递给 webservice。换句话说,webservice 中的方法被调用,但它的所有参数都有默认值。我可以自己解析 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