Zend Amf And Flex

21,442 views

Published on

Introsuction to using Zend AMF with Zend Framework and Adobe Flex

Published in: Technology, Education
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
21,442
On SlideShare
0
From Embeds
0
Number of Embeds
166
Actions
Shares
0
Downloads
159
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Zend Amf And Flex

  1. 1. Zend AMF and Flex
  2. 2. Zend Framework <ul><li>Web site: http://framework.zend.com </li></ul><ul><li>Zend Framework (ZF) is an open source, object-oriented web application framework implemented in PHP 5 and licensed under the New BSD License. </li></ul><ul><li>  </li></ul><ul><li>  ZF was publicly announced at the first Zend Conference in October 2005. On July 1, 2007, Zend Framework 1.0 was released. </li></ul><ul><li>  </li></ul><ul><li>Current Version 1.7.7 http://framework.zend.com/download/latest </li></ul>
  3. 3. Why are people using Zend? <ul><ul><li>Use-at-will Framework </li></ul></ul><ul><ul><li>Provides components for MVC, Table Data Gateway and Row Data Gateway design patterns </li></ul></ul><ul><ul><li>All components in Zend Framework are object oriented </li></ul></ul><ul><ul><li>Takes advantage of the latest development features </li></ul></ul><ul><ul><ul><li>AJAX </li></ul></ul></ul><ul><ul><ul><li>Search Engine </li></ul></ul></ul><ul><ul><ul><li>Web Services </li></ul></ul></ul><ul><ul><li>BSD License (Enterprise Friendly) </li></ul></ul><ul><ul><li>Well Documented </li></ul></ul>
  4. 4. Adobe Flex <ul><li>http://www.adobe.com/products/flex/ </li></ul><ul><li>  </li></ul><ul><li>Flex is an open source framework used to create cross-platform Rich Internet Applications (RIA)  </li></ul><ul><li>  </li></ul><ul><li>Adobe Released Flex 1.0 in March of 2004 </li></ul><ul><li>  </li></ul><ul><li>Current SDK: 3.3 </li></ul><ul><li>  </li></ul><ul><li>Flex Builder IDE based on Eclipse </li></ul>
  5. 5. AMF Action Message Format <ul><li>  Action Message Format is an object exchange binary format accessed through a Remote Procedure Call (RPC) </li></ul><ul><li>  </li></ul><ul><li>Adobe Systems published the AMF binary data protocol specification on December 13, 2007 and announced that it will support the developer community to make this protocol available for every major server platform. </li></ul>
  6. 6. AMF Benefits <ul><ul><li>AMF Objects are small compressed using zlib </li></ul></ul><ul><ul><li>Fast serialization / deserialization </li></ul></ul><ul><ul><li>Native Types and Custom classes supported </li></ul></ul>
  7. 7. http://www.jamesward.com/blog/2007/04/30/ajax-and-flex-data-loading-benchmarks/
  8. 8. Zend AMF <ul><li>  </li></ul><ul><li>Info: http://framework.zend.com/manual/en/zend.amf.html  </li></ul><ul><li>  </li></ul><ul><li>Download: http://framework.zend.com/download/amf </li></ul><ul><li>Zend_Amf provides support for Adobe's Action Message Format (AMF), to allow communication between Adobe's Flash Player and PHP. Specifically, it provides a gateway server implementation for handling requests sent from the Flash Player to the server and mapping these requests to object and class methods and arbitrary callbacks. </li></ul>
  9. 9. Files: Root <ul><li>app/ </li></ul><ul><li>lib/ </li></ul><ul><li>log/ </li></ul><ul><li>pub/ </li></ul><ul><li>tmp/ </li></ul>
  10. 10. Files: app/ <ul><li>conf/ </li></ul><ul><li>    setupdb.sql </li></ul><ul><li>    main.ini </li></ul><ul><li>models/     Contacts.php </li></ul>
  11. 11. Files: lib/ <ul><li>Zend/ </li></ul><ul><li>    Acl.php </li></ul><ul><li>    Acl/ </li></ul><ul><li>    ......... </li></ul><ul><li>Riafox/     Flexstring.php </li></ul><ul><li>    Flexstring/ </li></ul>
  12. 12. Files: pub/ <ul><li>css/ </li></ul><ul><li>img/      </li></ul><ul><li>js/ </li></ul><ul><li>swf/ </li></ul><ul><li>     main.swf </li></ul><ul><li>xml/ </li></ul><ul><li>    crossdomain.xml </li></ul><ul><li>    gateway-config.xml </li></ul><ul><li>  </li></ul><ul><li>.htaccess </li></ul><ul><li>index.php </li></ul>
  13. 13. Files: pub/xml/crossdomain.xml <ul><li><cross-domain-policy> <allow-access-from domain=&quot;zendamf.riafox.com&quot; /> </cross-domain-policy> </li></ul>
  14. 14. Files: pub/.htaccess <ul><li>RewriteEngine on RewriteRule ^(crossdomain.xml)$ pub/xml/crossdomain.xml [L] RewriteRule ^(gateway-config.xml)$ pub/xml/gateway-config.xml [L] RewriteRule !.(js|ico|gif|jpg|png|xml|swf)$ index.php php_flag magic_quotes_gpc off php_flag register_globals off php_flag display_errors on php_value session.auto_start 0 </li></ul>
  15. 15. Files: pub/index.html <ul><li>  </li></ul><ul><li>error_reporting(E_ALL|E_STRICT); date_default_timezone_set('America/Boise'); $rootPath = dirname($_SERVER[&quot;DOCUMENT_ROOT&quot;]); define('APPLICATION_PATH', $rootPath . '/application'); set_include_path('.' . PATH_SEPARATOR . $rootPath.'/library' . PATH_SEPARATOR . $rootPath.'/application/models/' . PATH_SEPARATOR . $rootPath.'/application/library/' . PATH_SEPARATOR . APPLICATION_PATH . '/library/App/View/Helper/' . PATH_SEPARATOR . get_include_path()); session_save_path(APPLICATION_PATH . '/temp'); include &quot;Zend/Loader.php&quot;; $server = new Zend_Amf_Server(); $server->setProduction(false);$server->addDirectory('../application/models/'); </li></ul><ul><li>$response = $server->handle();  </li></ul><ul><li>  echo $response; </li></ul>
  16. 16. Files: app/models/Test.php <ul><li><?php class Test{   public  function hello($text) {     return &quot;Message Received:{$text}&quot;;   } } ?> </li></ul><ul><li>  </li></ul>
  17. 17. services-config.xml <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <services-config>     <services>         <service id=&quot;amfphp-flashremoting-service&quot; class=&quot;flex.messaging.services.RemotingService&quot; messageTypes=&quot;flex.messaging.messages.RemotingMessage&quot;>             <destination id=&quot;zend&quot;>                 <channels>                     <channel ref=&quot;my-zend&quot;/>                 </channels>                 <properties>                     <source>*</source>                 </properties>             </destination>         </service>     </services>     <channels>         <channel-definition id=&quot;my-zend&quot; class=&quot;mx.messaging.channels.AMFChannel&quot;>             <endpoint uri=&quot;http://zendamf.riafox.com/gateway.amf&quot; class=&quot;flex.messaging.endpoints.AMFEndpoint&quot;/>         </channel-definition>     </channels> </services-config> </li></ul>
  18. 18. compiler settings <ul><li>add -services &quot;C:path-to-servicesservices-config.xml&quot; </li></ul>
  19. 19. main.mxml <ul><li><mx:RemoteObject id=&quot;myservice&quot;     fault=&quot;faultHandler(event)&quot;     showBusyCursor=&quot;true&quot;     source=&quot;Test&quot;     destination=&quot;zend&quot;>         <mx:method name=&quot;hello&quot; result=&quot;responseHandler(event)&quot; />     </mx:RemoteObject> </li></ul><ul><li>  </li></ul><ul><li>http://zendamf.riafox.com/public/test/main.html </li></ul>
  20. 20. Resources <ul><ul><li>The ABCs of AMF Format </li></ul></ul><ul><ul><li>Ajax and Flex Data Loading Benchmarks </li></ul></ul><ul><ul><li>Wade Arnold Blog Zend AMF </li></ul></ul><ul><ul><li>ZF Programmer's Reference Guide </li></ul></ul><ul><ul><li>AMF3 Specifications </li></ul></ul><ul><ul><li>Latest Zend Framework Download </li></ul></ul><ul><ul><li>Zend AMF Download </li></ul></ul><ul><ul><li>Adobe 3.3 Language Reference   </li></ul></ul>
  21. 21. Questions? http://www.slideshare.net/riafox/zend-amf-and-flex   How to Find Us     @riafox @richbreton @ben_whitaker Web site: http://www.riafox.com

×