Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Delphi7 method input parameters

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.

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

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.

I can't undersand what's wrong

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 has soLiteralParams at options:

init:

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 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

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>

null input parameter. The problem is in prefix xsd

like image 478
Andrew Kalashnikov Avatar asked Oct 10 '22 21:10

Andrew Kalashnikov


1 Answers

Delphi uses RPC/Encoded SOAP whereas WCF uses Document/Literal/Wrapped SOAP. So you need to tell Delphi to use the same format. You could do this by specifying soLiteralParams in the THttpRio.Converter.Options.

like image 73
Darin Dimitrov Avatar answered Oct 15 '22 10:10

Darin Dimitrov