Got my Domain

September 4, 2008

Since long time I wanted to buy a domain and use it for hosting samples. I got stuck with work and could not find time to buy one 🙂

Finally I got it 🙂 its 🙂 I will be using this for hosting sample applications rather than posting screen shots in my blogs 🙂 Home page is not that great, will improve it 🙂

I created my first post using PHP as back end for a Flex application. Please check out the article at this URL.


Invoking PHP functions from Flex using AMFPHP

September 4, 2008

You can invoke functions in a PHP class from a Flex application using Remoting as we used to do with Java classes. I used AMFPHP ( ) for invoking PHP functions.

In this article we will see how to set up AMFPHP on the system and then we will create a Flex application to invoke the PHP function and also create PHP function which will serve our request.

Note: You need to have a web server with PHP 5 configured to have this sample working.

Setting up AMFPHP

1.       Download under amfphp_1.9_beta2 from this URL

2.       Create folder called amfphpsamples in the document folder of your Apache server configured with PHP 5

3.       Extract the file to amfphp-1.9.beta.20080120

4.       From extracted amfphp-1.9.beta.20080120\amfphp folder, copy services folder, core folder, gateway.php and globals.php into the amfphpsamples folder created above

5.       Now we have our AMFPHP set up in our web application folder

6.       Try invoking gateway.php and see if it is set up properly. (http://<servername&gt;:<portnumber>/amfphpsamples/gateway.php)

Creating PHP class

1.       Create file named FirstService.php under amfphpsamples/services/com/adobe

2.       Open the FirstService.php and paste the code from the PHP class at this URL

3.       In our PHP file, we have a class called FirstService

4.       In the class we have a function called greetUser()

5.       Now we have our PHP class ready

Creating Flex application to invoke PHP function

1.       Create Flex project using your Flex Builder

2.       Copy the code from this file into your application MXML file

3.       In the code you can see a RemoteObject with endpoint property pointing to the gateway.php

4.       RemoteObject also has a source property set to com.adobe.FirstService, which is the class we created above

5.       On button click we are adding event listeners to ResultEvent.RESULT and FaultEvent.FAULT events of the RemoteObject

6.       If the response is successful the result event handler is invoked and fault handler is invoked if there is a problem invoking the service

7.       In the result handler you can notice that we are using event.result to retrieve the response from the server.

8.       event.result will contain the response from the server

You can try the sample at this URL

That’s it we have our first Remoting sample using Flex and PHP working. I will post more samples using WebORB PHP soon 🙂

Securing BlazeDS destinations using custom Tomcat REALM authentication

September 4, 2008

I was planning to write a post on how to secure BlazeDS/LCDS destination using custom REALM authentication in Tomcat. Before wrting, I searched for articles on this topic and found good articles on how to do the same. I thought of including the URLs to those articles instead of writing a new article.

You can find details on how to create a custom authentication class for Tomcat at this URL

BlazeDS developer guide has a awesome article with sample on how to secure your destinations based on Tomcat Realm authentication. Please find article at this URL


Basic authentication:

Custom authentication:

Secure your destinations 🙂