Delphi 2007 を使用しています。
私が作成した WSDL インポーターを使用して、外部 WSDL から、いくつかの機能を含むユニットを作成しました。
残念ながら、返される XML の明示的な結果の型は含まれていません。
関数 getHash('login', 'password') は、次の XML を返します。
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="...........>
<SOAP-ENV:Body>
<ns1:getHashResponse>
<return xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">code</key>
<value xsi:type="xsd:string">1004</value>
</item>
<item>
<key xsi:type="xsd:string">error</key>
<value xsi:type="xsd:string">Login was not successfull</value>
</item>
</return>
</ns1:getHashResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
これから、正しいクラスを定義しようとしています。これまでに思いついたのは次のとおりです。
TKeyValue = class;
TArrayofKeyValue = array of TKeyValue;
TKeyValue = class(TRemotable)
private
FKey: String;
FValue: String;
published
property Key: String read FKey write FKey;
property Value: String read FValue write FValue;
end;
function getHash(const uid: WideString; const pwd: WideString): TArrayOfKeyValue; stdcall;
このコードでテストすると、TKeyValue の 2 つのインスタンスが返されます。しかし、どちらも空です。クラス定義の何が問題になっていますか? それとも、間違った方法で進んでいますか?
より良い WSDL が最善ですが、それは私次第ではありません。