The following example use's AMFPHP and nusoap to create an easy to use, plug and play, whois lookup for your flash application. Below is a brief overview, however this application is mainly for sample code. This example assumes that you have amfphp and nusoap set-up and working correctly. If you don't, check out some of the articles or visit us on the flash-db message boards. (Try doing a whois on www.microsoft.com and read through the results).
The following assumes that you have Flash Remoting up and running, either AMFPHP or other.
If your using AMFPHP and have not installed nusoap yet, you may want to read over - Consuming Web Services with Flash and AMFPHP. In short download the latest version of nusoap and place this in a folder called 'lib' inside the flashservices directory (flashservices/lib). And that's it! Your now ready to consume webservices in flash.
AMFPHP in combination with Nusoap was used in this example, but the same actionscript code and services should work with any remoting software package (coldfusion, .net, etc).
The above example use's the following web service:- Flash Whois - http://www.flash-db.com/services/?ID=28&sType=Utility
Flash Whois Service
#include "NetServices.as"
#include "NetDebug.as"
// create result handler for results and error messages.
serviceResult = new Object();
serviceResult.onResult = function(result){
Output.text = result;
}
serviceResult.onStatus = function(status){
Output.text = status.description;
}
// sets up the gateway connection.
var serverConn = NetServices.createGatewayConnection("<PathToYourGateway>/gateway.php");
// sets up the service.
var service = serverConn.getService("http://www.flash-db.com/services/ws/flashWhois.wsdl", serviceResult);
// sets the onPress event handler for the submit button, which calls the doWhois service.
submit_btn.onPress = function() {
Output.text = "loading whois information for "+Input.text;
// Set the params and call the service
// username and password can be anything, domain name must be a valid domain name.
params = {
username:"anything",
password:"anything",
domain:Input.text
}
if (Input.text != "" && params.domain != "") {
// calls the method.
service.doWhois(params);
} else {
Output.text = "Please enter a domain name";
}
}
And that's it. Hopefully enough to play around with.
Download the Source Files - be sure to check the message board for help/support.
Note to advanced AMFPHP users: One of the best and easiest ways to combine the error handling of AMFPHP, Nusoap, and the flash NetConnection debugger is by adding the following to the nuSoapImpl function (located in app/Executive.php):
place this after the if/else statment containing $result = $soapclient->call
// $err is an error string that nusoap sets when ever an error is encountered.
This will return any errors nusoap encounters to the NetConnection debugger. So for example if you enter an invalid wsdl file, or an invalid method name, you may get something similar to this back:
"Error: error with nusoap, operation xxxxx not present."
Only attempt to add this if you are familiar with AMFPHP.
place this after the if/else statment containing $result = $soapclient->call
if ($err = $soapclient->getError()) {
trigger_error("error with nusoap, ".$err, E_USER_ERROR);
} else {
return $result;
}
// $err is an error string that nusoap sets when ever an error is encountered.
This will return any errors nusoap encounters to the NetConnection debugger. So for example if you enter an invalid wsdl file, or an invalid method name, you may get something similar to this back:
"Error: error with nusoap, operation xxxxx not present."
Only attempt to add this if you are familiar with AMFPHP.

5 most recent
Tree menu
Flex form by email
Flash Spell Checker
Flash Remoting Library
MX 2004 Chart/Poll
Applications