COMPANY
COMMUNITY
BLOG
HELP
MY ACCOUNT
EN PT ES

Imagen6368E

From GeneXus 8.0 RC: Structured Data Types (III)

(17/06/2003-00:00)
In this issue, we will comment on the definition of more complex structured data types (collections), their properties, and new cases of Webservice use.

Collections

Although we have already defined a client's telephone list -a simple-type collection (numerical)- a new SDT may be designed, or the same one for that matter, as a list of clients.

In this case, two data types are created: Clients and Clients.Client.

Loading a collection

A Client-type variable is supposed to be loaded just like the Client. However, it is necessary to use the "new" command, since default SDTs are assigned by reference. We may load the client list by using the following code:

For Each
&Client = new Clients.Client ()
&Client.Name = Clinam
&Client.Identity = CliDoc
&Client.Nationality= &Nationality
&CLient.Address.Company = Cliadd
&Client.Telephone.Add(CliTel)
&Clients.add(&Client)
Endfor

Go through a collection

After loading the client structure, it is possible to go through it by using the For IN Array, with the following code lines:

For &Client in Clients
&Clinam = &client.Name
...
EndFor

Providing /using services

Now we can provide/use the client list in a Webservice. Just as in the case of client data, to provide it we only have to define a procedure with the SOAP call protocol and retrieve a Client-type variable per parameter.

Using the WSDL inspector.

Many of the available webservices provide structured data. For instance, http://www.swanandmokashi.com/HomePage/WebServices/Horoscope.asmx?WSDL provides the zodiac sign list with the corresponding forecasts, on a daily basis.

In order to program this interface in your portal, you should:

1) Include the webservice definition from design.

2) Define two variables: "array" and "item" in a Web Panel object with the new data types, and a "ws" variable with the service:

3) Code the loading of a subfile going through the array resulting from the invocation:

Event Load
&array = &ws.GetHoroscope()
For &item in &array
&ZodiacSign = &item.ZodiacSign
&ForeDaily = &item.DailyForecast
load
endfor

EndEvent // Enter

Related
From GeneXus 8.0 RC: Structured Data Types (SDT)
From GeneXus 8.0 RC: Structured data types (II)
Web Grid Selection
GeneXus releases its next version