如何解决WCF Delphi7方法的输入参数
| 我有wcf网路服务(basicHttpBinding)。我们的Delphi7客户无法正确使用它。 我已经用WCF Extras使WSDL扁平化了。好。 Delphi7 wsdl导入器生成正确的代理。 现在,我遇到了输入参数的问题。它们始终具有默认值(字符串为空,整数为0)。 方法delphi7的输出值正常。 例如: public string Test(string a)
{
return \"Test\"+a;
}
此方法始终返回\“ Test \”。我的日志记录系统修复程序我有一个空的at方法,因此问题出在正确的传输输入参数上。
我不能理解发生了什么事
编辑
代理:
ISyncer = interface(IInvokable)
[\'{D46862B0-BDD3-8B80-35A8-A2AC69F24713}\']
function Test(const a: String): String; stdcall;
end;
呼叫:
Sync:=(dmMain.HTTPRIO1 as ISyncer);
test:=Sync.Test(\'5555\');
dmMain.HTTPRIO1在选项中具有soLiteralParams:
在里面:
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>
编辑2
我研究http请求:
。净
<Test> xmlns=\"http://tempuri.org/\"><a>5555</a></Test>
工作正常;
德尔福7
<Test xmlns=\"http://tempuri.org/\"><xsd:a>5555</xsd:a></Test>
空输入参数。
问题出在前缀xsd中
解决方法
Delphi使用RPC /编码SOAP,而WCF使用文档/文字/包装SOAP。因此,您需要告诉Delphi使用相同的格式。您可以通过在
THttpRio.Converter.Options
中指定soLiteralParams
来实现。
, 我已经做到了。
我通过THttpRio的事件处理程序OnBeforeExecute在每个服务目录上固定了肥皂信封。
我修复(删除名称空间前缀),它可以工作。
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。