Friday, December 05, 2008

Building Service Clients With Flex and AIR (Improved) Course Online

During both MAX events, James Ward and I taught a course on building Adobe Flex and AIR clients for various service types (including Web Services, REST, HTML clients, Flash Remoting) talking to PHP and ColdFusion. During the first session in San Francisco, we had a few glitches (the image had MySQL already running that prevented the WAMP stack from being able to start and gave only a cryptic "Java.socket.exception" exception). We also had the remote server at www.webservicex.com go down during the middle of the class as well as some hard drive glitch that wouldn't let a valid Flex project be loaded. I was perplexed as all of these things had been tested several times prior -- however, things happen.

To ensure this did not happen again, I have rewritten a new version of BlazeDS which now includes the Apache Axis 1.4 SOAP Stack and some additional *.jars. We also rearranged the course so it can be taken as a self-paced tutorial on how to talk to the various types of courses.

I have placed the entire courseware up for grabs by anyone at http://www.web2open.org/courses.html. I would like to invite anyone to download and take or even consider teaching these courses to your user groups. They are both release under Creative Commons license but please share and share alike. I put a lot of time and effort into both of there courses.

If you took the courses at MAX, please also realize that James and I always put too much content into every course to account for a best case scenario (the entire class types fast, asks no questions, has great eyesight, and makes no mistakes). Given this rarely happens, we often do not get through the entire course; so we designed this to make it a self-paced tutorial complete with instruction guide in case you want to teach it to others. All the projects are included and well commented. User group managers, please make this available to your groups.

To those of you who attended the first MAX Lab in San Francisco, we apologize again for the glitch but things were beyond our control. This should more than make up for it. All the other classes went very well (we did this 5 times).

Audience Assumptions
- Attendees are familiar with XML
- Attendees understand the basics of network architecture and various protocols
- Attendees have Adobeʼs AIR runtime installed
- Attendees have Flex Builder 3 installed

Prerequisites and Downloads

Before you can take this course, you must have the following
software installed on your computer:

- Adobe Flex Builder 3 or later
- Adobe AIR 1.1 runtime or later
- Java ™ SDK 1.5 or higher

Additionally, you must have the CD of courseware that includes the
two directories and a soft copy of this handout.

The following image must be on all computers:
1. The AIR runtime
2. Flex Builder 3 or later
3. BlazeDS
4. MAMP (Mac) or WAMP (Windows)
5. ColdFusion (optional)

A preconfigured MAMP image (Mac OS X) is available here:

A preconfigured WAMP images (Windows) is available here:
http://www.web2open.org/courses/MAX2008_BuildingServiceClients.zip

When you get it:

1. unzip it to the desktop

2. open a command window and navigate to the directory \MAX2008_BuildingServiceClients\sampledb and type in “startdb”. It should start up a database. Leave that command window open.

3. Grab a new command window and navigate to \MAX2008_BuildingServiceClients\tomcat\bin and type “catalina run”. This should start up tomcat.

Please then test the following URLs to make sure they are there:

http://localhost:8400/axis – to make sure Apache Axis 1.4 is up and running fine
http://localhost:8400/xml/Wines.xml
http://localhost:8400/xml/crossdomain.xml


The AIR runtime may be downloaded from:
http://get.adobe.com/air/

A trial version of Flex Builder 3 may be downloaded from:
http://www.adobe.com/products/flex/

Use the BlazeDS included in the build.

MAMP may be downloaded from:
http://www.mamp.info/en/download.html

WAMP may be downloaded from:
http://www.wampserver.com/en/download.php

A trial version of ColdFusion may be downloaded from:
http://www.adobe.com/products/coldfusion/

The following files must be on all computers

~/RootFolder/AttendeeHandouts.pdf
/AttendeeProjects
/CompletedProjects
/BlazeDS
/MAMP (For Mac OS X only)
/WAMP (For Windows only)

Each computer must have an internet connection

Description

Learn how to build SOA clients with Flex and Adobe AIR. In this hands-on session, you will explore how to build various service clients using the WSDL Import Wizard, hand-coded ActionScript 3.0, and simple REST-based services. Flash Remoting and performance metrics will also be covered. This session is intended for those who build front-end service clients for business applications. Attendees should come prepared to write code or partner with someone else writing code. (This session complements "Deploying Services with BlazeDS and LiveCycle Data Services ES.")
Preparations for this Lab

1. If the Windows image you are using has a MySQL instance running, it must be killed first. To do this, please go to Start -> Control Panel -> Administrative Tools -> Services and stop the MySQL instance.



2. Next, start up the BlazeDS server. To do this, open a Command Window (or shell) and navigate to \BlazeDS\sampledb (if on OS X, use forward slashes instead of back for path).

a. On Windows, type in “startdb”. This should start the database.

C:\Documents and Settings\Administrator\Desktop\MAX2008_BuildingServiceClients\s
ampledb>startdb

C:\Documents and Settings\Administrator\Desktop\MAX2008_BuildingServiceClients\s
ampledb>java -cp hsqldb.jar org.hsqldb.Server
[Server@1d58aae]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@1d58aae]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@1d58aae]: Startup sequence initiated from main() method
[Server@1d58aae]: Loaded properties from [C:\Documents and Settings\Administrato
r\Desktop\MAX2008_BuildingServiceClients\sampledb\server.properties]
[Server@1d58aae]: Initiating startup sequence...
[Server@1d58aae]: Server socket opened successfully in 40 ms.
[Server@1d58aae]: Database [index=0, id=0, db=file:flexdemodb/flexdemodb, alias=
flexdemodb] opened sucessfully in 1512 ms.
[Server@1d58aae]: Startup sequence completed in 1552 ms.
[Server@1d58aae]: 2008-11-25 12:29:14.087 HSQLDB server 1.8.0 is online
[Server@1d58aae]: To close normally, connect and execute SHUTDOWN SQL
[Server@1d58aae]: From command line, use [Ctrl]+[C] to abort abruptly




b. On Mac, type sudo sh ./startdb.sh




3. Now start the servers.

a. On Windows, do this by changing directories until you are at the \BlazeDS\tomcat\bin directory (note: use forward slashes on Unix based Systems) and type catalina run


C:\Documents and Settings\Administrator\Desktop\MAX2008_BuildingServiceClients\t
omcat\bin>catalina run

Using CATALINA_BASE: C:\Documents and Settings\Administrator\Desktop\MAX2008_B
uildingServiceClients\tomcat
Using CATALINA_HOME: C:\Documents and Settings\Administrator\Desktop\MAX2008_B
uildingServiceClients\tomcat
Using CATALINA_TMPDIR: C:\Documents and Settings\Administrator\Desktop\MAX2008_B
uildingServiceClients\tomcat\temp
Using JRE_HOME: C:\Program Files\Java\jdk1.6.0_10
Nov 25, 2008 12:34:20 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in produ
ction environments was not found on the java.library.path: C:\Program Files\Java
\jdk1.6.0_10\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\CFu
sionMX7\verity\k2\_nti40\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\
Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\PC-Doc
tor for Windows\services;C:\Program Files\ATI Technologies\Fire GL 3D Studio Max
;C:\WINDOWS\Downloaded Program Files;C:\Program Files\Common Files\MXI;C:\Progra
m Files\Common Files\Adobe\AGL;C:\Program Files\QuickTime\QTSystem\
Nov 25, 2008 12:34:20 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8400
Nov 25, 2008 12:34:20 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 432 ms
Nov 25, 2008 12:34:20 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 25, 2008 12:34:20 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
Nov 25, 2008 12:34:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8400
Nov 25, 2008 12:34:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 25, 2008 12:34:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/20 config=null
Nov 25, 2008 12:34:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3988 ms



b. On Mac OS X, do this by changing directories until you are at the /BlazeDS/tomcat/bin directory and type
sudo sh ./catalina.sh run



4. You should be able to validate the servers are up and running by hitting the following URL: http://localhost:8400/xml/Wines.xml

7 comments:

  1. Duane,

    Where can I find MAX 2009 Course on "Building Service Clients"?

    ReplyDelete
  2. Just uploaded it now while waiting to get to SAP TechEd in Vienna at YVR. Here is the URL:

    http://www.web2open.org/courses/BuildingServiceClients2009.zip

    License: You are free to take and use this anyway you feel is appropriate, helps you become rich and famous, get's you a partner of the opposite (or same) sex, makes you enjoy life or any other benefit. There is no need to credit me and you may go forth and claim it is your work. You do all this at your own risk and you agree to respect the intellectual property of any other contributors or third parties involved. Remember that we make stuff like this to help the community. When you do cool stuff, pay it back to the community! Karma is great!

    If you get really lucky as a result of this, but members of the Adobe Evangelism team beer one day and we'll call it even!

    Enjoy life, enjoy coding!

    ReplyDelete
  3. Hey thanks for posting the service client 2009 so soon. It was really great having face time with you at the "Meet the LiveCycle team" session at MAX09. Not sure if you remember but I was the guy who asked the LiveCycle/SAP integration documents.

    ReplyDelete
  4. Hi Duane, are these course downloads still available (the links to the zip files don't work) or is there a more uptodate course you could suggest? TIA.

    ReplyDelete
  5. These courses will be available on uberity.com in the coming weeks. They are all being updated for the newer builds of the Flex and AIR SDKs. I can provide a copy of the old courseware if you want to contact me directly at duane at puberty dot com

    duane

    ReplyDelete
  6. the full URL is http://www.uberity.com. You can sign up for being the first to know what we're up to.

    duane

    ReplyDelete

Do not spam this blog! Google and Yahoo DO NOT follow comment links for SEO. If you post an unrelated link advertising a company or service, you will be reported immediately for spam and your link deleted within 30 minutes. If you want to sponsor a post, please let us know by reaching out to duane dot nickull at gmail dot com.