Invoking Service Methods

Once the gateway has successfully located the service identified by the Flash client, it tries to invoke the service method called by the client. The gateway must first get a reference to an instance of the service. It uses introspection to locate the service method and then call it.

For each service type, the gateway uses a different technique to get a reference to an instance of the service. Regardless of the service type, once the gateway has a reference to the service it invokes the service method in the same manner. It looks for a method that has the same case-insensitive name and parameters that match the converted parameters from ActionScript. If it can not find a matching service method, the gateway throws a java.lang.Exception with the message “Service [service name] does not have a method [method name] that matches the name and parameters provided.” Refer to Section 7.5.1 earlier in this chapter for an example of how to remedy this error.

If the gateway finds the service method, it invokes the method using introspection and returns the result to the Flash client after converting the Java objects in the result to ActionScript objects. If the result implements flashgateway.sql.PageableResultSet, the gateway saves a reference to the result in the user session so that the Flash client can use the paging features of the RecordSet component.

Invoking Service Methods on JavaBeans

For JavaBean services, the gateway first looks to see if an instance of ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.