WCF Delphi7的方法输入参数 [英] WCF Delphi7 method input parameters

查看:517
本文介绍了WCF Delphi7的方法输入参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有WCF的Web服务(basicHttpBinding的)。我们Delphi7的客户不能正确使用它。 我已经拉平与WCF额外的WSDL。好。 Delphi7的WSDL导入生成代理正确的。

I've got wcf web-service(basicHttpBinding). Our Delphi7 clients couldn't correct consume it. I've already flatten the WSDL with WCF extras. Ok. Delphi7 wsdl importer generate proxy correct.

现在我已经得到了问题的输入参数。他们总是有默认值(空字符串,0 INT)。

Now I've got the problems with input parameters. they always have default values (empty for strings, 0 for int).

从Delphi7中得到确定方法的输出值。 例如:

Output values from methods delphi7 gets ok. for example:

        public string Test(string a)
        {
              return "Test"+a;
        }

此方法总是返回测试。我已经得到了在方法一空的我的日志系统修复,所以这个问题是正确传递输入参数。

This method always return "Test". My logging system fix that I've got empty a at method, so the problem is correct transfer input parameters.

我不能undersand什么问题

I can't undersand what's wrong

修改

代理:

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的选项:

dmMain.HTTPRIO1 has soLiteralParams at options:

初​​始化:

InvRegistry.RegisterInvokeOptions(TypeInfo(ISyncer), ioLiteral);

电话后,我得到异常消息:

After call I get exception with message:

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片段:

wsdl fragment:

<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请求:

I research http requests:

.NET

<Test> xmlns="http://tempuri.org/"><a>5555</a></Test>

工作正确的;

works correct;

Delph7

<Test xmlns="http://tempuri.org/"><xsd:a>5555</xsd:a></Test>

空输入参数。 问题是在preFIX XSD

null input parameter. The problem is in prefix xsd

推荐答案

我已经做到了。 我通过THTTPRIO事件处理OnBeforeExecute固定SOAP信封在每一个服务sonsume。

I've done it. I fixed soap envelope at every service sonsume through event handler OnBeforeExecute of THttpRio.

我修复(删除命名空间prefixes)和它的作品。 谢谢

I fix(remove namespace prefixes) and it works. Thanks

这篇关于WCF Delphi7的方法输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆