Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The HTTP Client Transport Connectivity Plug-in | Using predefined generic event definitions to invoke services with a JSON payload
Using predefined generic event definitions to invoke services with a JSON payload
You can invoke an HTTP service with a JSON payload by using predefined generic Apama event definitions. To do so, you have to use the JSON with generic request/response event definitions option when adding the HTTP client connectivity plug-in. See also Adding the HTTP client connectivity plug-in to a project.
This "generic" option uses a predefined chain definition with dynamic chain instances to invoke multiple HTTP services, and it uses event types in the com.softwareag.connectivity.httpclient package. For detailed information about the available event types, see the API Reference for EPL (ApamaDoc) .
The following example shows how to invoke an HTTP service using the generic events:
action performRequest() {
// 1) Get the transport instance
HttpTransport transport := HttpTransport.getOrCreate("www.example.com", 80);
// 2) Create the request event
Request req:= transport.createGETRequest("/geo/");
// 3) Execute the request and pass the callback action
action handleResponse(Response res) {
// 4) Handle the response
if res.isSuccess() {
// 5) Extract data from the payload
log res.payload.getString("location.city") at INFO;
} else {
log "Failed: " + res.statusMessage at ERROR;

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.