我有 wcf web 服务(basicHttpBinding)。我们的Delphi7客户端无法正确使用它。
我已经使用 WCF 附加功能简化了 WSDL。好的。 Delphi7 wsdl 导入器生成代理正确。
现在我遇到了输入参数的问题。它们总是有默认值(字符串为空,int 为 0)。
delphi7 方法的输出值正常。
例如:
public string Test(string a)
{
return "Test"+a;
}
此方法始终返回“Test”。我的日志系统修复了 at 方法为空的问题,因此问题是正确传输输入参数。
我不明白出了什么问题
EDIT
proxy:
ISyncer = interface(IInvokable)
['{D46862B0-BDD3-8B80-35A8-A2AC69F24713}']
function Test(const a: String): String; stdcall;
end;
call:
Sync:=(dmMain.HTTPRIO1 as ISyncer);
test:=Sync.Test('5555');
dmMain.HTTPRIO1 有 soLiteralParams 选项:
init:
InvRegistry.RegisterInvokeOptions(TypeInfo(ISyncer), ioLiteral);
通话后我收到异常消息:
Error deserializtion message body for operation Test.
Operation formatter detects ivalid message body. Expecting node type "Element"
with name "Test" and namespace "http://tempuri.org". Actually node type "Element"
with name "xsd:String" and namespace "http://w3.org/2001/XMLSchema"
wsdl 片段:
<xsd:element name="Test">
−
<xsd:complexType>
−
<xsd:sequence>
<xsd:element minOccurs="0" name="a" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
−
<xsd:element name="TestResponse">
−
<xsd:complexType>
−
<xsd:sequence>
<xsd:element minOccurs="0" name="TestResult" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
EDIT2
我研究http请求:
.NET
<Test> xmlns="http://tempuri.org/"><a>5555</a></Test>
工作正常;
Delph7
<Test xmlns="http://tempuri.org/"><xsd:a>5555</xsd:a></Test>
输入参数为空。
问题出在前缀上xsd