WCF Delphi7 Method Input Parameters

I have a wcf web service (basicHttpBinding). Our Delphi7 customers could not fix the consumption. I have already smoothed out WSDL with additional WCF features. OK. Importer Delphi7 wsdl correctly generates proxies.

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

Output values ​​from delphi7 methods become normal. eg:

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

This method always returns "Test". My registration system corrects that I have an empty method, so the problem is with the correct input parameters of the transfer.

I can not say what is 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 settings:

INIT:

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

After the call, I get an exception with the 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 am researching http requests:

.NET

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

works correctly;

Delph7

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

null input parameter. The problem is the xsd prefix

+5
source share
2 answers

I have done it. I fixed the soap envelope on every sonsume service through the OnBeforeExecute event handler from THttpRio.

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

0
source

Delphi uses RPC / Coded SOAP, while WCF uses Document / Literal / Wrapped SOAP. Therefore, you need to say that Delphi uses the same format. You can do this by specifying soLiteralParams in THttpRio.Converter.Options .

+4
source

Source: https://habr.com/ru/post/889182/


All Articles