Using the connection infrastructure

The Connection API provides a flexible way to make REST-style requests to resources using a variety of protocols.

Overview

The Connection API is used to send requests to resources and work with their responses. You can work with a variety of protocols using the Connection API. The zero.core module includes a default set of protocol implementations to work with remote services using HTTP and HTTPS, and an SMTP transport to send e-mail messages. In addition, a number of connection extensions are supplied as separate modules, which provide other protocols for use with the Connection API, such as the Protocol extension for JMS. You can also write your own protocol extensions for use with the connection infrastructure.

Requests made using the Connection API are logically routed through connection destinations. By defining a connection destination in the zero.config file, you can define properties for the connection protocol or even associate connection handlers to process the requests and responses. This can be done without changing the logic in the application source files.

Writing applications that use the connection infrastructure

Applications can make use of the connection infrastructure in a number of ways:

  1. Use the Connection and EmailConnection APIs directly from Java™ classes and Groovy scripts.
  2. Use the flow activities supplied in the Assemble flow module, zero.assemble.flow, such as GET, POST, PUT, DELETE and sendMail, or activities supplied in one of the connection extension modules.
  3. Use the PHP APIs supplied in the zero.php.connection module.

The following topics describe how to write a Java or Groovy application that uses the Connection and EmailConnection APIs:

Using the Connection API
Contains an overview of the Connection API and general information about its use.
Working with HTTP or HTTPS services
Contains additional information for applications using the Connection API to work with HTTP or HTTPS services.
Sending an e-mail using EmailConnection
Describes the EmailConnection API, which simplifies the steps required to construct and send an e-mail message.

Configuring the connection infrastructure

The following topics describe how to configure connection destinations to specify protocol configuration or attach connection handlers to process the requests and responses:

Configuring destinations
Contains an overview of connection destination configuration.
Configuring protocols
Describes how to specify protocol configuration parameters as part of a connection destination configuration.
Configuring connection handlers
Describes how to attach connection handlers to a connection destination.
Simple logging connection handlers
Describes how to use the simple logging connection handlers to help diagnose connection problems.

Writing extensions to the connection infrastructure

The following topics describe how to extend the connection infrastructure by writing a connection handler or protocol transport:

Creating a connection handler
Describes how to write a connection handler to monitor or modify requests and responses sent through a connection destination.
Creating a custom protocol transport
Describes how to write a new protocol transport implementation and register it with the connection infrastructure.

Protocol reference

The following topics contain reference information for the default set of protocol implementations contained in the zero.core module:

HTTP and HTTPS protocols
Can be used to work with REST resources on remote servers.
SMTP protocol
Can be used to send an e-mail. This is used by the EmailConnection API.
File protocol
Can be used read and write files on the local filing system.
FTP protocol
Can be used read and write files held by an FTP server.
Event protocol
Fires a transmit event to allow Connection requests to be served locally using an event handler.

Protocols supplied in connection extensions

The following connection extension modules contain additional protocol implementations that can be used with the Connection API.

Protocol extension for JMS
The zero.connection.jms extension enables an application to communicate with enterprise applications using an external Java Messaging Service (JMS) provider using the Connection API or the POSTJMSMessage flow activity.
Protocol extension for SFTP
The zero.connection.sftp extension allows an application to read and write files held by an SFTP server.
REST to SOAP extension
The zero.connection.soap extension transforms simple REST requests made by an application using the Connection API into SOAP messages.
IBM® Reliable Transport Extension for WebSphere® sMash
The zero.messaging.connection extension enables an application to send messages using the Reliable Transport Extension, using the messaging protocol.

Version 1.1.31300