-
Notifications
You must be signed in to change notification settings - Fork 0
Consuming AMF Services
For a good explanation on how "the Enyo framework enables apps to work with services in general, and Web services in particular" take a look at the enyo wiki
In enyo-amf requests are made using either the enyo.Amfx object or
the enyo.AmfService component. enyo.Amfx derives from enyo.Async,
the base kind for handling asynchronous operations.
enyo.AmfService is a wrapper for enyo.Amfx that can be used
when you want to use Async as a component.
enyo.amf is an enyo object that represents the AMF Client. The AMF Client
must be initialized before any service calls. In the following JavaScript
fragment
enyo.amf.init("amfphp", "http://127.0.0.1/server/gateway.php");enyo.amf.init sets the destination and endpoint of the AMF Client.
The library will automatically test connectivity over the current channel and get a clientId assigned by the server, by sending a flex.messaging.messages.CommandMessage with a CLIENT_PING_OPERATION, before sending any service requests.
The Basic Example illustrates the complete client-server communication.
enyo.Amfx extends enyo.Async, providing a wrapper
for JavaScript's XmlHttpRequest (XHR) API.
enyo.Amfx publishes all the properties of the
enyo.AmfxProperties object. You may set values for these properties
to customize different aspects of your AMF request, such as the source,
operation, params, and optional headers.
Like enyo.Async, enyo.Amfx is an Object, not a Component. Do not try to
make enyo.Amfx objects inside a components block.
Also like enyo.Async, if you find yourself wanting to use enyo.Amfx as a
component, you should probably be using AmfService instead.