To use the Google Places Service, you will create the
following EGL parts:
- A set of Record parts. Each definition is the basis of a variable
that will be used to receive data from the service.
- An Interface part. This definition is the basis of a service-access
variable, which is used in the call statement
that invokes the service.
You can create the Record parts in various ways, but in this
lesson you will access a REST service on the web and include, in the
web address, the details necessary to retrieve data from the service.
The New EGL Record wizard will create the Record
parts that correspond to the data that is retrieved at development
time.
Do as follows:
- In the MortgageServiceProject project,
in the EGLSource folder, right-click the services package
and click .
- In the first page of the New EGL Record wizard,
accept the details about the source folder and package and type the
following name for the new source file:
GooglePlaceRecords
- Click Next.
- In the Templates page, click Records
from XML. Click Next.
- In the Records from XML window, click Create
from a URL and paste the following URL into the URL field:
https://maps.googleapis.com/maps/api/place/search/xml?location=-33.8670522,151.1957362
&radius=1000&types=cafe&sensor=false&key=AIzaSyD_K9zveT6jhxgCApduywaOTuD5FiQFgpI&language=en
Combine
the two lines into a single-line URL with no spaces.
- Click Next. The wizard
displays a Summary page that previews the code
it will place in the new file.
Note: The Google API Service sometimes
returns no data, in which case only the ResultSet Record
part is created. The lack of data is most likely on Sundays. If the
service is unavailable or does not return data, click Cancel and
wait for a later time to complete the tutorial.
- Click Finish, which saves the file.
- If you see errors in your source file, compare your code
to the file contents in Finished code for GooglePlaceRecords.egl after Lesson 10.
- Close the file.