Saj

I think you have multiple problems in your setup.

Here is a quick HelloWorld example:

My PHP server is set up with two directories - Zend (Holds the Zend
Framework) and
ZendServices (Where all my AMF Services files are located in sub
directories). In this
ZendServices directory I have a Samples directory which has a helloamf
directory. In
this directory I have two files - index.php and HelloWorld.php...

=========================================================
index.php:
<?php
ini_set('include_path',
ini_get('include_path').':/path/to/Zend/directory/');
require_once("Zend/Amf/Server.php");
include "HelloWorld.php";
$server = new Zend_Amf_Server();
$server -> setClass( "HelloWorld" );
echo( $server -> handle() );
=========================================================
HelloWorld.php:
<?php
class HelloWorld
{
     public function say($message)
     {
         $date = getdate();
         return "You said: " . $message . " on " . $date["weekday"];
     }
}
?>
=========================================================

Now to the Flex files. I have a project named ZendAMFSampleHelloAMF (You
can name yours
whatever you want).

=========================================================
ZendAMFSampleHelloAMF.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application pageTitle="Hello World" layout="absolute"
xmlns:mx="http://www.adobe.com/2006/mxml";>
     <mx:Script>
         <![CDATA[
             import mx.rpc.events.ResultEvent;

             public function doSay(event:Event):void
             {
                 svcHello.say(txtSomething.text);
                 txtSomething.text = "";
             }

             public function doSayResult(event:ResultEvent):void
             {
                 txtSaid.text += String(event.result) + "\n";
             }
         ]]>
     </mx:Script>
     <mx:RemoteObject id="svcHello" destination="zend"
source="HelloWorld">
         <mx:method name="say" result="doSayResult(event)" />
     </mx:RemoteObject>
     <mx:Panel width="385" height="250" layout="absolute" title="Say
What?" verticalCenter="0" horizontalCenter="0">
         <mx:Label x="10" y="12" text="Something:" />
         <mx:TextInput id="txtSomething" right="10" top="10" left="88"
text="Flex" enter="doSay(event)" />
         <mx:HRule y="40" left="10" right="10" />
         <mx:Label x="10" y="52" text="You said:" />
         <mx:TextArea id="txtSaid" bottom="10" left="10" right="10"
top="80" editable="false" />
         <mx:ControlBar horizontalAlign="right">
             <mx:Button label="Say" enabled="{txtSomething.text.length ==
0 ? false : true}" click="doSay(event)" />
         </mx:ControlBar>
     </mx:Panel>
</mx:Application>
=========================================================
services-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
     <services>
         <service id="zend-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
             <destination id="zend">
                 <channels>
                     <channel ref="zend-endpoint"/>
                 </channels>
                 <properties>
                     <source>*</source>
                 </properties>
             </destination>
         </service>
     </services>
     <channels>
         <channel-definition id="zend-endpoint"
class="mx.messaging.channels.AMFChannel">
             <endpoint
uri="http://myserver.com/ZendServices/Samples/helloamf/";
class="flex.messaging.endpoints.AMFEndpoint"/>
         </channel-definition>
     </channels>
</services-config>
=========================================================

Note that the endpoint points to my helloamf directory on my server (See
above).
There is no gateway.php file with Zend_Amf.

Now, all you need to do is set your compiler preference additional
compiler arguments to:

-locale en_US -services "services-config.xml"

If you need a further example on how to pass value objects, please let
me know.


HTH



Steve



--- In flexcoders@yahoogroups.com, Sajid Hussain <enchanter_...@...>
wrote:
>
>
>
>
> Hello Gurus ,
>
> I am facing one issue where i am attempting to use Zend_amf but that
code exactly work well with Amfphp,
> I have seen all internet resources for zend and I am very courios on
thier machine same code is working why not at mine :(
> if I am trying to access gateway(Zend File) it work well but its not
working from Flex App .
> I have follwoing code and structure
>
> Gateway File :
> <?php
> require_once 'Zend/Amf/Server. php';
> require_once 'include/services/ BListsService. php';
> require_once 'include/services/ UserService. php';
> // Instantiate the server
> $server = new Zend_Amf_Server( );
> $server->setClass('BListsSer vice');
> $server->setClassMap( 'BListsVO' , 'BLists');
> $server->setClass('UserServi ce');
> $server->setClassMap( 'UserVO', 'User');
> $server->setProduction( false);
> $server->handle(); // if I am echoing this its not execute and instead
it comes up for download
> ?>
>
> Services-xml :
> <?xml version="1.0" encoding="UTF- 8"?>
> <services-config>
> <services>
> <service id="amfphp-flashrem oting-service"
> class="flex. messaging. services. RemotingService"
> messageTypes= "flex.messaging. messages. RemotingMessage">
> <destination id="zend">
> <channels>
> <channel ref="my-zend" />
> </channels>
> <properties>
> <source>*</source>
> </properties>
> </destination>
> </service>
> </services>
> <channels>
>     <channel-definition id="my-zend" class="mx.messaging .channels.
AMFChannel">
>         <endpoint uri="http:// localhost/ gateway.php" class="flex.
messaging. endpoints. AMFEndpoint" />
>     </channel-definition>
> </channels>
> </services-config>
>
> Remote Services :
>
> <mx:RemoteObject
>         id="BListsService"
>         source="BListsServi ce" destination= "zend" endpoint="http:
//localhost/ gateway.php"
>         showBusyCursor= "true">
>     </mx:RemoteObject>
>
> Please Reple
> -Saj
>

Reply via email to