skip to main content
Corticon Extensions Guide : Reviewing what is in the sample extensions : What's in the Service Callout Sample Projects : Weather Callout Java and Rule Projects

Try Corticon Now
Weather Callout Java and Rule Projects
Corticon Studio includes a sample project that shows how service callouts can be reused when they can be parameterized so that each instance can have a different configuration.
The Weather Callout Java Project is a Java project that includes the source code for a service callout to call the REST API on to retrieve weather data for individual cities. The Weather Callout Rule Project uses the callout in the Java project to retrieve data for cities specified in Location entities. The service callout is specific to the vocabulary in that it looks for Location entities with specific attributes. To retrieve live weather data for a city you need to create an account on, and then generate an API key that you provide as a property on the callout. By default, the keyword 'demo' is used, and sample weather data is generated.
The Weather Callout Java project contains a src folder with the source code for the weather callout and has on its build path the standard Java system library, org.json-20120521.jar, and CcExtensionApi.jar.
The src folder contains the source code for two Java classes.
The Weather Callout Rule Project is a set of rule assets that demonstrate the Weather Callout Java samples.
The project uses the service callout and the supporting vocabulary, Rulesheet, Ruleflow, and Ruletest for the project. It also contains the JAR file of the extensions built from the Java project, weather_service.jar.
The Ruleflow uses a service callout and a Rulesheet to perform its functions.
The Ruletest shows that the weather callout behaves as expected.
The Weather Callout sample is accessed from the Studio's Help > Samples in the Advanced section.