Solved

Delphi soap (return array)

Posted on 2016-09-08
6
32 Views
Last Modified: 2016-10-28
I just started to use Delphi,
I don't know how to iterate over arrays.
I already did the connection between Delphi and soap.
I want to get the name (for exemple Arnold ) and to set in a TForm1.Edit1Change
I know how to do when I get a string but I don't know for a array.


in wsdl, I get:
  ArrayOf_xsd_string = TArray<String>;

  customerCtrlPortType = interface(IInvokable)
  ['{3C177C7E-853B-10B9-0F41-CA0B073BBF64}']
    function  ViewCustomer(const id: Integer): ArrayOf_xsd_string; stdcall;
  end;

in PHP, I get:
  Array ( [1] => Array ( [first] => Schwarzenegger [last] => Arnold ) [2] => Array ( [first] => Stallone [last] => Sylvester ) )

in xml, I get:
<item>
      <key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:int">1</key>
      <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Map">
            <item>
                  <key xsi:type="xsd:string">first</key>
                  <value xsi:type="xsd:string">Schwarzenegger</value>
            </item>

            <item>
                  <key xsi:type="xsd:string">last</key>
                  <value xsi:type="xsd:string">Arnold</value>
            </item>
      </value>
</item>
<item>
      <key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:int">2</key>
      <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Map">
            <item>
                  <key xsi:type="xsd:string">first</key>
                  <value xsi:type="xsd:string">Stallone</value>
            </item>
            <item>
                  <key xsi:type="xsd:string">last</key>
                  <value xsi:type="xsd:string">Sylvester</value>
            </item>
      </value>
</item>



Can you please help me
0
Comment
Question by:luffy monkey d
  • 2
  • 2
6 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 250 total points
ID: 41789344
you are somewhat vague on what you need
there are so many ways to store a set of strings ...

i see some generics  usage in the other languages and i also see xml

using generics with a Tlist:
http://docwiki.embarcadero.com/CodeExamples/Berlin/en/Generics_Collections_TList_(Delphi)

i also see Array
http://docwiki.embarcadero.com/RADStudio/Berlin/en/Structured_Types_(Delphi)#Arrays

and a generics array:
http://docwiki.embarcadero.com/CodeExamples/Berlin/en/Generics_Collections_TArray_(Delphi)

what are you trying to do ?
0
 

Author Comment

by:luffy monkey d
ID: 41789379
I will try the first (Tlist)
0
 

Author Comment

by:luffy monkey d
ID: 41789392
I started by

Delphi:
procedure TForm1.Button1Click(Sender: TObject);
var
    resultat : TArray<String>;
begin
    resultat := (HTTPRIO1 as customerCtrlPortType ).ViewCustomer(1);
    Edit1.Text := resultat[1];
end;

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 41790150
and ?
0
 
LVL 26

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 250 total points
ID: 41792905
This kind of arrays always start from (zero indexed). So...better use Low and High function to get bounds...
var
    resultat : ArrayOf_xsd_string;
    i:Integer;
begin
    resultat := (HTTPRIO1 as customerCtrlPortType ).ViewCustomer(1);
    for i:=Low(resultat) to High(resultat) do
    begin
       Memo1.Lines.Add(resultat[i]);
     end;

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question