Problem accessing some services using Flex : RangeError
geekglue - July 2, 2008 - 05:58
| Project: | AMFPHP |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm developing a Flex/Drupal site. I am having a problem accessing some Services. I am able to run the problem services from Drupal and it shows that the amfphp server is running. I get a suitable response in Flex when I call system.connect or user.login using RemoteObject. But I get a RangeError when I try to use node.load or view.getView. I have amfphp 1.9 beta 2. I have found a few references to this problem at http://groups.drupal.org/node/2768 but no one seems to have solved the problem there. Any help or suggestions appreciated.

#1
I have found a partial solution to my problem. By defining the fields that I require the RangeError goes away. My assumption is that the formatting of one or more fields as returned by the node and views services breaks the amfphp response. If that is correct requesting those fields would result in a return of the RangeError. Hopefully they won't be fields I'll need.
#2
#3
I replicated this problem within a service I'm currently developing. The node.load service uses services_node_load to load the node data. This method uses the fields parameter as the second parameter. If the fields array is empty then this problem appears. The workaround I've used in my service is to check if fields is empty and to set some default fields to include in the result (see below):
if(count($fields) == 0){
$fields = array('nid','type','title','body','taxonomy','files');
}