我有wcf web-service(basicHttpBinding).我们的Delphi7客户端无法正确使用它.
我已经使用WCF附加功能展平了WSDL.好. Delphi7 wsdl导入器生成代理正确.
我已经使用WCF附加功能展平了WSDL.好. Delphi7 wsdl导入器生成代理正确.
现在我遇到了输入参数的问题.它们总是有默认值(对于字符串为空,对于int为0).
public string Test(string a) { return "Test"+a; }
此方法始终返回“测试”.我的日志系统修复了我已经空了一个方法,所以问题是正确的传输输入参数.
我不能忽视什么是错的
编辑
代理:
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>
EDIT2
我研究http请求:
.净
<Test> xmlns="http://tempuri.org/"><a>5555</a></Test>
工作正确;
Delph7
<Test xmlns="http://tempuri.org/"><xsd:a>5555</xsd:a></Test>
null输入参数.
问题出在前缀xsd中
解决方法
Delphi使用RPC / Encoded SOAP,而WCF使用Document / Literal / Wrapped SOAP.所以你需要告诉Delphi使用相同的格式.您可以通过在THttpRio.Converter.Options中指定soLiteralParams来完成此操作.