The Service Browser uses the remoting gateway to present a list of service classes and their methods. By selecting one of your methods, you will be presented with a page that allows you to call it; by entering arguments and observing the output in the “results” tab below, you can test remoting methods here.
The text inputs for arguments accept arguments in JSON (JavaScript Object Notation) or “object literal” format; essentially, valid ECMAScript (JavaScript/ActionScript) syntax.
String arguments can be entered directly without requiring quote marks, and number arguments can be entered directly as well.
To pass an array as an argument, use the JSON/ECMAScript array literal syntax – comma-separated values between square brackets. For example, if the parameter expects an array of numbers, you would enter it something like:
[1, 3, 5.5, 44]
A two-dimensional array in JSON format is entered as an array of arrays like this:
[[1, 2, 3], [5, 7, 15], [1, 7, 2]] .
Objects (such as VOs) can also be input here, using JSON/ ECMAScript object literal syntax like this:
{id: 1, label: ‘A label’, notes: ‘Some notes’}.
Objects and arrays can also be nested inside each other:
[{id: 1, label: ‘first object’}, {id: 99, label: ‘object with an array in it’, numbers: [13, 44, 97]}, {id: 34, label: ‘object with another object in it’, thing: {‘things’: 14, ‘gadgets’: 6, ‘tchockies’: 0}}]
In addition to numbers and strings, these are all valid types of arguments an AMFPHP remoting method can accept.
For more about JavaScript/ActionScript array-literal syntax and the object/associative-array duality of ECMAScript, consult your friendly neighborhood Internet.
Note that for some reason the service browser does not much care for double-quotes, so when entering object arguments, use the single-quote format for strings.
Also note that currently, although PHP supports optional arguments to a method by specifying a default value in the method signature, the service browser does not have a way to “skip” entering an argument. If you leave an input box blank, the parameter will receive an empty string.
AMFPHP, Flash Platform
Recent Comments