Solved

Delphi soap (return array)

Posted on 2016-09-08
6
17 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 36

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 36

Expert Comment

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now