Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi soap (return array)

Posted on 2016-09-08
6
Medium Priority
?
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 1000 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 38

Expert Comment

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

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 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