Skip to main content

Call-out to Weather Web Service

  • Nov 19, 2018 9:06 AM UTC
  • 0 replies
  • 7 views

Jan Cees Boogaard
Forum|alt.badge.img+2

Community Sample

Call-out to Weather Web Service

Author Eddy Knochs
Date submitted

 

Category Uniface Client Server
Sample file getweather.zip

Description

Sample Description This sample has 2 forms that call 2 different web services which supply weather information. These forms display some decorative attributes, but the main goal is to demonstrate web service call out, and the use of structs to manipulate the returned data. GETWEATHER2 This form calls a web service that supplies a 7 day forecast for the specified zip code, and thus it is limited to US zip codes. In recent times the data has become stale, i.e. it reports forecasts from March or September 2014, for reasons unknown. This will not diminish the sample's teaching value. GETWEATHER3 This form prompts for a country name, which is then used to call the web service and populate a list of weather report locations within that country. Those locations are listed as hyperlinks which will call the web service for an up to date weather report. Not all locations have weather data to report at all times, and the attributes often differ from location to location, and possibly time to time. This is why the weather report is largely undecorated. Installation The export file requires Uniface 9.5 and above, and contains the following:

  • The 2 forms mentioned above
  • The 2 web service signatures in subsystem WEATHER
  • One web service generated a model with 2 entities, but these are not used in this sample
  • Nine glyphs in library SYSTEM_LIBRARY are supplied for decoration

Compile all the objects except the application model. Ensure the SOP U2.0 connector is specified in the assignment file. Learning Outcomes You will see simple usage of Structs to manipulate the results of web services callout. Not all web services are thoroughly documented, and it was necessary to learn how to handle the output by empirical study and experimentation. Local procedures are supplied for Fahrenheit and Celsius scale conversions, which are called as user defined functions. The forentity loop is also demonstrated in one of the forms.