2.1 Installing Flash Remoting


Flash Remoting is built into ColdFusion MX (and later) and JRun 4, making these two application servers attractive to begin working with Flash Remoting. ColdFusion Markup Language (CFML) has the added bonus of being relatively easy to learn. Flash Remoting is also available from Macromedia as an add-on for .NET and J2EE servers. Table 2-1 shows the languages that you can use to create server-side Flash Remoting services in each type of installation.

Table 2-1. Flash Remoting official language support

Flash Remoting installation

Languages

ColdFusion MX or later

CFMLServer-Side ActionScriptJavaCFScript

JRun 4

JavaServer-Side ActionScript

J2EE

Java

ASP.NET

VBC#JScript .NetC++Any other ASP.NET language

Table 2-2 lists the open source projects underway that support Flash Remoting using various languages.

Table 2-2. Open source Flash Remoting language support

Project name

Language

URL

AMFPHP

PHP

http://www.amfphp.org

FLAP

Perl

http://www.simonf.com/flap

OpenAMF

Java

http://www.openamf.org

The following sections detail the installation and configuration of Flash Remoting in the server environments that are supported.

2.1.1 ColdFusion MX

ColdFusion MX and later run on a J2EE (Java 2 Enterprise Edition) platform. Therefore, you can write simple programs using CFML and the resulting application is compiled into a Java servlet.

Admittedly, the variants of ColdFusion can get confusing. There are three basic versions. Free 30-day trial versions of the two commercial versions are available. After 30 days, they revert to the Developer Edition, which restricts IP address access but is otherwise full-featured :

ColdFusion MX Server Developer Edition

Included as part of Macromedia Studio MX or available as a free download from Macromedia's site. The Developer Edition is equivalent to the Enterprise Edition but can be accessed from only one remote IP address. It is intended for a single developer to use in testing.

ColdFusion MX Server Standard Edition

A standalone version for Windows and Linux. This is the most basic and economical option for ColdFusion deployment on one server.

ColdFusion MX Server Enterprise Edition

A standalone version for Windows, Linux, Solaris, and HP-UX for large-scale enterprise deployment, allowing server clustering and sandbox security. It also enhances J2EE integration by providing support for JavaServer Pages (JSP) servlets and JSP Tag Library imports. This version also runs atop an existing J2EE installation, including IBM WebSphere Application Server 4 or later, Macromedia JRun 4, Sun ONE Web Server 6 or later, and BEA WebLogic Server 6.1 or later.

Table 2-3 summarizes the platforms that ColdFusion MX Server will run on.

Table 2-3. ColdFusion MX Server supported platforms

Platform

Operating system

Web servers

Windows

98 [1]
ME [1]
NT 4.0 Workstation SP6A
NT 4.0 Server SP6A
NT 4 Server, Enterprise Edition
2000 Professional SP2
2000 Server SP2
2000 Advanced Server
2000 Datacenter Server
2003 Server (a.k.a. .NET Server)
XP Home
XP Professional
Apache 1.3.12-1.3.27
Apache 2.x
JRun HTTP Server
iPlanet 6.x
iPlanet 4.x
Netscape 3.6x
IIS 4.0 and higher (on OSes that support IIS)

Linux

Red Hat Linux 6.2 - 7.2
SuSE Linux 7.2, 7.3
TurboLinux 8 Server
Red Hat Linux AS 2.1
Apache 1.3.12-1.3.27
Apache 2.x
JRun HTTP Server
iPlanet 6.x
iPlanet 4.x
Netscape 3.6x

Macintosh

Mac OS X [1]

JRun 4Apache Tomcat

Solaris [2]

Solaris 7
Solaris 8S
olaris 9
Apache 1.3.12-1.3.27
Apache 2.x
JRun HTTP Server
iPlanet 6.x
iPlanet 4.x
Netscape 3.6x

HP-UX [2]

System 11.00

Apache 1.3.12-1.3.27
Apache 2.x
JRun HTTP Server
iPlanet 6.x
iPlanet 4.x
Netscape 3.6x

[1] Not recommended in a production environment

[2] Enterprise edition only

ColdFusion MX's J2EE underpinnings allow ColdFusion applications to be extended in Java. ColdFusion MX can also be deployed on top of an existing J2EE installation if you purchase the Enterprise edition. Using the Enterprise edition, you can run ColdFusion MX on a Macintosh as well, on top of a JRun 4 or Tomcat installation. Macromedia supports Macintosh installations for development only and not in a production environment. Installation on a Macintosh is covered at:

http://www.macromedia.com/support/coldfusion/j2ee/cfmx-mac-onjrunandtomcat.html

The system requirements for running ColdFusion MX on J2EE Servers are listed in Table 2-4. For web server requirements, consult your J2EE server documentation.

Table 2-4. J2EE Application Server supported platforms for ColdFusion MX

J2EE Application Server

Operating systems

IBM WebSphere Application Server Advanced Edition 4.0.3 and Application Server 5

Windows 2000, 2003Windows NT4Solaris 7, 8Red Hat Linux 7.1, 7.2SuSE Linux 7.2

Macromedia JRun 4

Windows 2000, 2003Windows NT4Solaris 7, 8Red Hat Linux 6.2-7.2SuSE Linux 7.2, 7.3

Sun ONE Web Server Version 6.02 and Version 7

Windows 2000, 2003Windows NT4Solaris 7, 8Red Hat Linux 6.2-7.2

BEA WebLogic Version 6.1 and Version 7

Windows 2000, 2003Windows NT4Solaris 7, 8Red Hat Linux 6.2-7.2

As per the Macromedia technote at http://www.macromedia.com/support/coldfusion/j2ee/#servers, although you can deploy the Enterprise edition on any J2EE-compliant application server, not all are fully tested and supported for production use. For development and evaluation purposes, Macromedia has also tested Flash Remoting on Sun J2EE SDK 1.3 (the reference implementation) and Tomcat 4.1.12 (and later).

It is best to consult the Macromedia site for the current requirements. Macromedia's site explains the details of the different ColdFusion variants and pricing:

http://www.macromedia.com/software/coldfusion/productinfo

Flash Remoting is also automatically installed as part of the ColdFusion MX Server package installation (Flash Remoting does not work with ColdFusion 5 or earlier versions). You can download and install the ColdFusion MX trial version, which will revert to a free developer's version after 30 days. The trial version is also included in the Studio MX package.

As per Table 2-1, ColdFusion MX or JRun 4 is required for building the back end of the Flash Remoting application using Server-Side ActionScript.

ColdFusion MX can be installed in several different ways and on a multitude of platforms. ColdFusion MX Server can be installed atop your existing web server (IIS, Apache, or others) or using the built-in web server. The built-in web server is a limited functionality web server, recommended for testing only and not recommended for production environments. More information on the built-in web server can be found at:

http://www.macromedia.com/support/coldfusion/adv_development/config_builtin_webserver

ColdFusion MX can also be installed side-by-side with an existing ColdFusion 5 installation, in which case it is installed with its own built-in web server on port 8500 rather than the standard web port 80. This port is crucial to making connections using Flash Remoting if you are running the standalone ColdFusion web server. You must specify the path to the server when you make your connection to a gateway URL, so if the server is running on port 8500 instead of port 80, the gateway connection code looks like this:

 var myURL = "http://localhost:8500/flashservices/gateway"; var myServer = NetServices.createGatewayConnection(myURL); 

Running side-by-side installations of ColdFusion 5 and ColdFusion MX lets you test existing ColdFusion 5 applications in the ColdFusion MX environment. Because ColdFusion MX was rebuilt from the ground up as a J2EE application, there may be compatibility problems with ColdFusion 5 applications, particularly with regard to the database connections, which have changed dramatically. There is a Compatibility Analyzer built into the ColdFusion MX Server that can help you determine the compatibility issues your older applications might have.

Installation of ColdFusion MX is straightforward and covered at length in the documentation that comes with the software and at http://livedocs.macromedia.com. Once installed, Flash Remoting is immediately available. You can test Flash Remoting on a standalone ColdFusion MX Server by browsing to the following URL:

http://yourservername:8500/flashservices/gateway

If you have a standard installation of ColdFusion MX Server that ties into your existing Apache, IIS, or other web server on port 80, you can test Flash Remoting by browsing to this URL:

http://yourservername/flashservices/gateway

If you see a blank page, you know that the gateway is working. If you see an error message or anything else on the page, something is wrong. Double-check your URL and port settings. There is no easy way to pinpoint and correct an installation error if you come across one. Usually, the only option is to recheck the steps you followed and reinstall the server. For more troubleshooting tips go to:

http://www.macromedia.com/support/coldfusion/installation.html

In a successful installation, you will not see a physical /flashservices/gateway directory in your server root. This path is a virtual directory that is known to the ColdFusion MX Server. It does not correspond to any physical directory on your machine.

After a successful installation of ColdFusion MX, you will have the flashgateway.ear file in the path_to_CFusionMX \runtime\servers\default\ folder.

If you have to reinstall the ColdFusion MX Server, you should delete the CFusionMX folder from your hard drive and restart the machine before attempting the reinstallation. Remnants of a past installation might cause errors, so when you run the installation program, select the option to uninstall a previous installation.

If you are upgrading a prior installation of ColdFusion Server, you can migrate your old ODBC and OLEDB data sources to ColdFusion MX Server, which uses JDBC. This can save you time when creating connections to existing databases. Existing ODBC data sources are migrated to JDBC format, which can exist side-by-side with the old ODBC data sources. Later modifying an ODBC data source will not affect the ColdFusion MX JDBC connections that bear the same data source name. JDBC data source configuration settings for ColdFusion MX Server are located in the path_to_CFusionMX \runtime\servers\default\SERVER-INF\jrun-resources.xml file.

Knowing how to create and connect to data sources is necessary for developing the server-side services of a Flash Remoting application. Data sources in ColdFusion MX are defined in the ColdFusion MX Administrator, the visual interface for administering ColdFusion applications. The ColdFusion MX documentation covers this topic thoroughly. Additionally, if you plan to develop your Flash Remoting services in Server-Side ActionScript rather than CFML, you will have full access to data sources defined in the ColdFusion MX Administrator.

As of this writing, there have been three major updaters to ColdFusion MX and a version upgrade to 6.1. Make sure you have the latest version of ColdFusion MX from the Macromedia site. Using Flash Remoting with ColdFusion MX is discussed at length in Chapter 5.

2.1.2 JRun 4

JRun 4 is Macromedia's enterprise-level J2EE application server, which supports JavaServer Pages (JSP). Although Flash Remoting is available as an add-on for other J2EE servers, the JRun 4 installation includes Flash Remoting out of the box, making it the easiest way to Flash-enable a J2EE site. When using JRun 4 for building Flash Remoting services, you will most likely be programming the server-side services in Java. In addition, JRun 4 allows Server-Side ActionScript to be used, which is unavailable in the Flash Remoting package for other J2EE servers.

JRun 4 also contains considerable enhancements that make it a worthy upgrade from previous versions of JRun, even without the Flash Remoting functionality. It is fully J2EE-compliant, having passed Sun's rigorous certification process for J2EE servers. In addition, it has full support for Enterprise JavaBeans (EJB) 2.0, hot-deployment technology (which avoids restarting the server when making changes), and enhanced support for web services.

Of the J2EE servers on the market, JRun is one of the easiest to get up and running, thanks to its visual installation wizard, and one of the easiest to administer because of the extensive administration interface. If you are just starting out and want to get your feet wet with the Java language in the J2EE arena, JRun 4 is a good choice.

ColdFusion MX can also be purchased separately and installed on top of an existing JRun 4 installation, yielding an effective combination of the power of J2EE with the ease-of-use of ColdFusion.

JRun installs with its own built-in web server to port 8100 by default, rather than the standard web port 80, to avoid conflicts with any existing web servers. The administrative server interface is available at port 8000, using the URL http://localhost:8000 . You can manually connect a JRun server to an existing web server as well, so that your pages can be accessed through the typical port 80. This can be done through the administrative interface of JRun. The built-in web server of JRun is recommended for developmental purposes only, not heavy use.

If you choose to develop your Flash Remoting applications using the default installation of the server on port 8100, you must specify the port in your connection to the Flash Remoting adapter:

 var myURL = "http://localhost:8100/flashservices/gateway"; var myServer = NetServices.createGatewayConnection(myURL); 

You can test the Flash Remoting functionality in a standard JRun 4 installation by pointing your browser to:

http://yourservername:8100/flashservices/gateway

where yourservername is the domain name or IP address of your web server. If you have set up a JRun server on the standard web port 80, you can point your browser to:

http://yourservername/flashservices/gateway

Again, just as in the ColdFusion installation, if you see a blank page, the Flash Remoting technology is working properly. If you don't see a blank page, check your JRun installation by testing the administrative interface or the samples included with JRun. If the server is working, you may have a problem with your gateway URL or port setting. If the server is not working, you may need to reinstall JRun. See the following URL for tips on JRun installation issues:

http://www.macromedia.com/support/jrun/installation.html

Chapter 7 shows how to install Flash Remoting in your web application rather than creating a server-wide testing installation.

2.1.3 Other J2EE Servers

Flash Remoting is available for purchase from Macromedia as a separate product, named Flash Remoting MX for J2EE, that will work in almost any J2EE-compatible server. There is a 30-day trial version available from http://www.macromedia.com/software/trial_download. The trial version reverts to a server-side development-only version after 30 days, with which you can continue to use the Flash Remoting servlet on your local machine for testing purposes.

Some of the servers that you can use with Flash Remoting include:

  • IBM WebSphere

  • Tomcat

  • BEA WebLogic server

  • HP Application Server

  • Caucho Resin

  • Oracle 9 i AS

  • JBoss

  • ATG Dynamo

The following operating systems support the Flash Remoting gateway adapter:

Windows
  • Windows NT Server 4.0 SP6a

  • Windows 2000 Server SP2

  • Windows 2003 (a.k.a. .NET server)

Linux
  • Red Hat 7.3

  • SuSE 7.3

Unix
  • SPARC Solaris 2.7

  • SPARC Solaris 8

These configurations are tested and supported by Macromedia, but other operating systems can be used at your discretion. I've successfully run Flash Remoting on Windows 2000 Professional with both JRun 4 and Tomcat in a testing environment. See http://www.macromedia.com/software/flashremoting/productinfo/system_reqs for the most recent system requirements for Flash Remoting.

To install Flash Remoting for J2EE in a server-wide test environment, follow these steps:

Windows

If you are loading from the CD-ROM, you can install from the CD-ROM's browser interface. If you are installing the trial version from the Macromedia web site, double-click the Flash Remoting for J2EE installer (named flashremoting-java-win-en.exe or something similar).

Linux

From a command line, type:

 <prompt>./flashremoting-java-linux.bin -i console 

This should begin the installation process.

Solaris

From a command line, type:

 <prompt>./flashremoting-java-solaris.bin -i console 

This should begin the installation process.

The installer gives you the choice of installing the .war or .ear archives with or without sample files and documentation. The installer creates a directory in which the archives are placed. After running the installer, follow these steps to deploy Flash Remoting on your server:

  1. Find either the flashgateway.war or the flashgateway.ear file. These files are found in C:\Program Files\Macromedia\Flash Remoting MX\ in a default installation on Windows.

  2. Deploy the flashgateway.ear or flashgateway.war file to the web application. The process varies from server to server. On Tomcat, for example, copy the .war file to the webapps directory and restart the Tomcat server. This deploys the flashgateway.jar file to the site_root \flashgateway\WEB-INF\lib directory. It also automatically deploys the web.xml file, which contains the servlet mappings for the flashgateway servlet, to the WEB-INF directory. The flashgateway directory is the default Flash Remoting location, but the .jar file can be deployed to other directories as well.

  3. Find the frconfig.txt file and make sure it is in the classpath of your server. This is necessary for the license information to be available to Flash Remoting. In a trial or developer's edition, the serial number will be blank. In the commercial version of Flash Remoting, your serial number needs to be in this file.

  4. Restart your server.

Test the functionality of the servlet by browsing to:

http://localhost/flashgateway/gateway

In a default Tomcat installation using port number 8080 instead of port 80, test the installation by browsing to:

http://localhost:8080/flashgateway/gateway

You should see a blank page. If the page is not blank, you must retrace your steps and make sure your web application mappings are correct. The Flash Remoting servlet is already mapped to /gateway in the web.xml file:

 <servlet-mapping>   <servlet-name>FlashGatewayServlet</servlet-name>   <url-pattern>/gateway</url-pattern> </servlet-mapping> 

The flashgateway.jar file can be deployed in any of your web applications by specifying the servlet mapping in the web.xml file for each application. Each application on your server can use its own path to the gateway. Chapter 7 explains how to install Flash Remoting in your own application using Flash Remoting for J2EE Updater 1, which includes a .jar archive.

In your ActionScript code, the gateway URL is used to create the connection as follows (for the default installation):

 var myURL = "http://localhost/flashgateway/gateway"; var myServer = NetServices.createGatewayConnection(myURL); 

If you are having trouble making the connection, make sure your URL follows this general format:

http://domain_or_ip_address:port/context_or_folder/servlet_mapping_for_gateway_servlet

A flashgateway/samples directory is also installed in the default gateway directory. These samples should work out of the box, assuming you are using a default web server at port 80. If not, you can open the .fla files in the subdirectories under the samples directory and change the paths in the ActionScript source.

2.1.4 ASP.NET

Flash Remoting is available for purchase from Macromedia as an add-on server component (DLL) for ASP.NET. There is also a 30-day trial version available from http://www.macromedia.com/software/trial_download. The trial version reverts to a server-side development-only version after 30 days, with which you can continue to use the DLL on your local machine for testing purposes.

Installation of Flash Remoting for ASP.NET is straightforward but requires that you have the Windows .NET SDK installed. The .NET SDK is available as a free download from the MSDN Download Center at:

http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en

You can also install the Flash Remoting samples to your web directory as part of the installation, which gives you a few sample C# and VB applications that utilize Flash Remoting. The samples can be run from the webroot \flashremoting\samples\default.htm file.

The default installation of Flash Remoting places the files necessary for the Flash Remoting service to work in the flashremoting directory under your web root. This is also the directory where the samples are installed. They should work out of the box if the installation was successful. To test the installation of Flash Remoting for ASP.NET, point your browser to the following URL:

http:// yourservername /flashremoting/gateway.aspx

Notice the differences between this connection and the ColdFusion and JRun connections:

  • The directory under yourservername is called flashremoting instead of flashservices .

  • The directory is a physical directory on your computer instead of a virtual directory.

  • You are making a call to the gateway.aspx file, which actually exists in the directory as a dummy placeholder file with two lines in the file:

     <%@Page %> <!-- This file is intentionally blank. --> 

Each .NET application on your server uses its own path to the gateway. The HelloWorld sample application from Chapter 1 used the flashremoting directory, but if your application uses a different directory name, or none at all, you need to change the connection. A typical installation using the gateway.aspx file in a subfolder at the root of your web application might look like this:

http://www.yourservername.com/subfoldername/gateway.aspx

Or if you are developing locally, you can use the localhost URL:

http://localhost/subfoldername/gateway.aspx

The installation of the commercial Flash Remoting for ASP.NET product also places the frconfig.txt file in the bin directory of your web root. This file contains the serial number of Flash Remoting. Additional IP addresses can be placed in this file as well. Chapter 8 covers ASP.NET in detail, including other installation and configuration idiosyncrasies.

2.1.5 PHP with AMFPHP

AMFPHP adds the possibility of using Flash Remoting on PHP application servers, which are not supported by the commercial Macromedia tools. Because AMFPHP is open source, it may be used free of charge but it is subject to change and is being actively developed. The latest AMFPHP package can be obtained from its official web site:

http://www.amfphp.org

Installation of AMFPHP is quite simple. Once you've downloaded and extracted the AMFPHP package, copy its flashservices directory to your web server's document root. Using Apache, the default Windows directory may be C:\Program Files\Apache Group \Apache\htdocs . In Unix and Unix-flavored systems, it may be /usr/local/apache/htdocs . On Mac OS X systems, it may be /Library/ WebServer /Documents . Alternatively, you can put the flashservices directory in the include_path of your PHP environment. See the AMFPHP readme file for details.

The default gateway.php file should be sufficient to begin development of services, which should be placed under your webroot /flashservices/services directory and should follow the structure of your base classpath. After installing the gateway, browse to the gateway path:

http://localhost/flashservices/gateway.php

If you see a blank page, the gateway is working. For more information on using Flash Remoting with PHP, see Chapter 9.

2.1.6 Typical Installations

The alphabet soup of technologies necessary to work with Flash Remoting can be confusing. Tables Table 2-5, Table 2-6, and Table 2-7 show several installations and typical components of each. These are not the only choices available by any means, but they represent the most typical configurations. Table 2-5 shows typical low-cost options for basic development.

Table 2-5. Typical low-cost Flash Remoting installation options for development

Operating system

Application server

Language

Web server

Database

Windows 98 or 2000 Professional

ColdFusion MX Developer's Edition

CFML or SSAS

Built-in HTTP server (port 8500)

MS Access

Red Hat Linux

Tomcat

Java

Apache (port 8080)

MySQL

Windows 2000 Professional

ASP.NET [3]

C#

IIS (port 80)

MS Access

Red Hat Linux

PHP [4]

PHP

Apache (port 80)

MySQL

Macintosh OS X

Tomcat/ColdFusion MX Developer's Edition

CFML or SSAS

Apache (port 80)

MySQL

[3] Requires add-on Flash Remoting server-side components

[4] Requires AMFPHP open source solution

Table 2-6 lists typical medium-cost installation options for medium- to high-traffic sites.

Table 2-6. Typical medium-cost Flash Remoting installation options

Operating system

Application server

Language

Web server (port 80)

Database

Windows 2000 Server

ColdFusion MX Professional

CFML or SSAS

IIS or Apache

SQL Server

Red Hat Linux

JRun 4

Java or SSAS

Apache

PostgreSQL

Windows 2000 Server

ASP.NET [5]

C#

IIS

SQL Server

FreeBSD Linux

PHP [6]

PHP

Apache

PostgreSQL

[5] Requires add-on Flash Remoting server-side components

[6] Requires AMFPHP open source solution

Table 2-7 lists typical high-end options for enterprise-level sites with high traffic.

Table 2-7. Typical high-end Flash Remoting installation options

Operating system

Application server

Language

Web server (port 80)

Database

Solaris 7 or 8

IBM WebSphere [1]

Java

IBM HTTP Server

DB2

Windows 2000 Advanced Server

ColdFusion MX for J2EE on top of JRun 4

CFML and Java

IIS

SQL Server

HP-UX or Solaris

Oracle 9i Application Server [7]

Java

Oracle HTTP Server

Oracle 9i

Red Hat Enterprise Linux AS

PHP [8]

PHP

Apache

IBM DB2

[7] Requires add-on Flash Remoting server-side components

[8] Requires AMFPHP open source solution

As you can see from Tables Table 2-5, Table 2-6, and Table 2-7, Flash Remoting can be deployed using a variety of different configurations. With the main ingredients of an application server (CFMX, J2EE, ASP.NET, or PHP), web server, database, and the Flash Remoting adapter in place, you can deploy the server-side services of Flash Remoting applications. Next, we'll talk about where these services go and how they are named.



Flash Remoting
Flash Remoting: The Definitive Guide
ISBN: 059600401X
EAN: 2147483647
Year: 2003
Pages: 239
Authors: Tom Muck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net