Debugging remote servicesThere are several ways to debug applications that access remote services.
Flash Builder Test Operation viewUse the Flash Builder Test Operation view to call operations from a service and view the results of the operation. Results include any error messages returned from the service. You can use the Test Operation view to view data returned from operations on services you write or services available from HTTP or web services. Test a service operationThis procedure assumes that you have written a service that you are testing or have access to an HTTP or web service.
Scripts to test server codeUse test scripts to view and debug server code before attempting to connect to the server in Flash Builder. Test scripts provide the following benefits:
ColdFusion ScriptsUse the following script, tester.cfm, to dump a call to a function. <!--- tester.cfm ---> <cfobject component="EmployeeService" name="o"/> <cfdump var="#o.getAllItems()#"> In tester2.cfm, you specify the method and arguments to call in the URL. <!--- tester2.cfm --->
<cfdump var="#url#">
<cfinvoke component="#url.cfc#" method="#url.method#" argumentCollection="#url#" returnVariable="r">
<p>Result:
<cfif isDefined("r")>
<cfdump var="#r#">
<cfelse>
(no result)
</cfif>
For example, call the getItemID() method in EmployeeService with the following URL: http://localhost/tester2.cfm?EmployeeService&method=getItemId&id=12 tester3.cfm writes a log that records calls to operations and dumps the input arguments using cfdump. <!--- tester3.cfm ---> <cfsavecontent variable="d"><cfdump var="#arguments#"></cfsavecontent> <cffile action="append" file="#getDirectoryFromPath(getCurrentTemplatePath())#MyServiceLog.htm" output="<p>#now()# operationName #d#"> PHP ScriptsUse the following script, tester.php, to dump a call to a function. <pre>
<?php
include('MyService.php');
$o = new MyService();
var_dump($o->getAllItems());
?>
</pre>
Add the following code to your PHP service to log messages during code execution. $message = 'updateItem: '.$item["id"];
$log_file = '/Users/me/Desktop/myservice.log';
error_log(date('d/m/Y H:i:s').' '.$message.PHP_EOL, 3, $log_file);
Add the following code to your PHP service to enable dumping to a log file: ob_start();
var_dump($item);
$result = ob_get_contents();
ob_end_clean();
$message = 'updateItem: '.$result;
$log_file = '/Users/me/Desktop/myservice.log';
error_log(date('d/m/Y H:i:s').' '.$message.PHP_EOL, 3, $log_file);
Network MonitorThe Network Monitor is available in Flash Builder from the Flex Debugging Perspective. The monitor must be enabled before it can be used to monitor data. See Monitoring applications that access data services for details about enabling and using the Network Monitor. |
|