Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Ajax Endpoint Reference

EndpointAjax

Ajax Endpoint Reference

Overview

Ajax is an acronym for Asynchronous JavaScript and XML, a cluster of related technologies that facilitate the creation of asynchronous Web applications. The Ajax Endpoint, which can be configured for inbound or outbound operation, creates a transport channel to send messages asynchronously to and from an Ajax server, which communicates with external Web resources.

Typically, the Ajax endpoint connects your Mule flow to an external web page, which can exchange information with a user somewhere in the Cloud. A JavaScript client attached to the webpage listens for user input, which it sends through the Ajax endpoint to your flow for processing.

Typically, the channel that the Ajax server and the Ajax endpoint use for communication is configured though a Global Element template known as a Connector Ref.

Configuration

Configuration of an Ajax endpoint typically requires two steps:

  1. Decide where you want to place the Ajax endpoint within your Mule flow, then drag it from the Palette to the appropriate place in the sequence of building blocks that make up your Mule flow.

  2. If you place the Ajax endpoint at the beginning of the flow, it will act as an inbound Endpoint (i.e., message source).

  3. If you place the Ajax building block in the middle or at the end of the flow, it will serve as an outbound endpoint.

  4. Configure the Ajax endpoint (and the Connector Ref it depends on to define its transport channel) by providing values for the fields on the various tabs on the Ajax endpoint Properties pane, which you open by double-clicking the Ajax icon on the Message Flow canvas.

The Ajax Endpoint Properties pane contains four tabs, as detailed below:

General Tab

AjaxPropGen

Property Description

Display Name

Defaults to the generic endpoint name, which in this case is Ajax. Change the display name, which must be alpha-numeric, to reflect the endpoint’s specific role, i.e. Interactive Opinion Poll Connection.

Channel

Specify the channel over which your Ajax endpoint communicates with the client web page. For example, /services/echo.

Advanced Tab

AjaxPropAdv

Property Description

Address

Enter the address for this endpoint, i.e. http://localhost:8081/file.

Response timeout

Specify how long the endpoint must wait for a response (in ms). The default is 1000 ms.

Encoding

Choose from a drop-down list the character set used for message data. (i.e. UTF-8).

Disable Transport Transformer

Check this box if you do not want to use the endpoint’s default response transport.

MIME Type

Select from the dropdown list one of the formats this endpoint supports.

Cache Messages

(Applies to outbound Ajax endpoint only). Check this box to enable the dispatcher to cache messages. Messages will only be cached if no clients are subscribed to the channel.

Message Cache Size

(Applies to outbound Ajax endpoint only). Enable Cache Messages, then select the cache size. Default cache size is 1024.

References Tab

AjaxPropRef

Field Description

Endpoint Reference

Use the drop-down list to select a previously configured global endpoint template, if any exist. If you have not created a global element for this type of endpoint, you do so by clicking Add and completing the fields on the pane that appears. Click Edit to modify a previously created global element.

Connector Reference

Use the dropdown list to select a previously configured connector template for this endpoint. If you have not created a connector for this type of endpoint, you can do so from this window by clicking Add. Click Edit to modify a previously created global element.

Request Transformer References

Enter a list of synchronous transformers that will be applied to the request before it is sent to the transport.

Response Transformer References

Enter a list of synchronous transformers that will be applied to the response before it is returned from the transport.

Documentation Tab

AjaxPropDoc

The Documentation tab lets you add optional descriptive documentation for your Ajax endpoint.

Field Description

Documentation

Enter a detailed description of this Ajax endpoint for display in a yellow help balloon that pops up when you hover your mouse over the endpoint icon.

Reference

For details on setting the properties for an Ajax endpoint using an XML editor, see the following: