Service Browser

The service browser allows you to test your services. It lists all services and methods and allows you to make test calls to them.


1. Select an Amfphp Method from the list on the left

Click a service method, and a dialog will appear allowing you to call it and optionally set some parameters. The service comments and the method comments appear in the dialog. These are also shown if you hover your mouse over the links in the list. Note that you can hide this description using the ‘Hide Description’ button.

2. Set your call parameters

A dialog is available for each parameter expected by the method. Mostly you can use simple values, such as « teststring », 345, false. If need you can input JSON text, that shall be validated directly in the editor. If you need to send a typed object, set ‘_explicitType’. For an example of this, see ExampleService/testComplicatedTypedObj.

A special formatting option in the comment so that fields can be be prefilled with something meaningful in the service browser.

You know it’s good practice to comment your code. The information in those comments can also be used to make Amfphp more useful to you.

Suppose your method comment contains the following line:

@param mixed $param example: {“_explicitType”:”myType”, “intVal”:2, “stringVal”:”bla”, “arrayVal”:[1,2, « ert »]}

Everything right of “example: “ is now used to prefill the input for the parameter.  It works with numbers, strings, booleans, and also with JSON values so that you can input complex types easily. Note that the example here uses “_explicitType” ,which would allow the object to be converted to a typed object.

3.Call the server

If you want no complications, just press ‘call’. This sends a JSON request to the server, and for basic testing is the best solution.

Double-click a method in the list on the left, and the Service Browser shall make a call to it with whatever default values are available. To set these default values, see Parameters above.

Advanced Options

The advanced calls give you the option to call using JSON (the same as the simple ‘call’), and to use AMF. Calling with AMF is useful when your service already works, but you want to see how it reacts with an AMF message. Note that you can send and receive typed objects with the Service Browser both with JSON and AMF. But because of programming limitations the Service Browser can only display receive typed objects when calling with JSON.

Call Repeater

Repeating a call automatically is useful for example if you want to tweak your system for performance and don’t want to test manually between each change. The idea is that as soon as a call returns, a new one is made. You can set the number of concurrent calls too. Currently this functionality is only available with AMF, not JSON.

4. View the server’s answer

 Once you call the method, you have a choice of ways to display the return data. Depending on what kind of return data you are expecting you will find one view or another more useful. You can see it as a tree, as PHP’s print_r or serialize, as json, or as raw.

When you have an exception, raw is advised as it allows you to see the server’s html.
Please note that the Back Office relies on the AmfphpAuthentication, AmfphpJson,  AmfphpDiscovery, and AmfphpMonitor plugins, so it won’t fully work without them. AmfphpMonitor is only for the Profiler. AmfphpAuthentication is needed only to control access. AmfphpJson and AmfphpDiscovery are needed by the Service Browser and the Client Generator. These plugins are all enabled by default, so you should not need to edit their configuration to get things working. 

News letter

Evénements Silex Labs sur Paris et sa région: Inscrivez vous à la Newsletter mensuelle

Silex Labs community Tweets

Facebook page