【问题标题】:Delphi <-> c# Webservice SOAP Request with missing parameters valuesDelphi <-> c# Webservice SOAP Request with missing parameters values
【发布时间】: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


    【解决方案1】:

    我找到了解决方案。在自动生成单元的末尾,在initialization 部分,缺少这一行:

    InvRegistry.RegisterInvokeOptions(TypeInfo(Service1Soap), ioDocument);
    

    【讨论】:

    • 确实!这条评论也帮助我解决了类似的问题。这绝对是 Delphi 中的一个错误(我使用的是 Delphi 7)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-20
    • 2022-12-02
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 2022-12-01
    • 1970-01-01
    相关资源
    最近更新 更多