Dang. I really don't know what to tell you man, it looks like everything is
in order. Unfortunately the services config file format is little documented
and uses new meanings for old terms which makes it completely cryptic and
unreadable, IMHO.

Patrick

2006/12/19, Jamie O <[EMAIL PROTECTED]>:

  For the stand-alone basic .mxml I used a copy of the basic example
Renaud gave - with a different URL for the gateway which is located on
a separate server. For the cairngorm / FDS version, here are the
changes I made to the default FDS .xml files

1) In services-config.xml, add the service to the <services> section
beneath the 4 service include path links add the service:
<services>
<service-include file-path="remoting-config.xml" />
<service-include file-path="proxy-config.xml" />
<service-include file-path="messaging-config.xml" />
<service-include file-path="data-management-config.xml" />

<service id="amfphp-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="AMFPHPDestination">
<channels>
<channel ref="my-amfphp"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>

2) In services-config.xml, Add to the <channels> section add the
following channel:
<channel-definition id="my-amfphp"
class="mx.messaging.channels.AMFChannel">
<endpoint
uri="http://externalURLaddress/amfphp/gateway.php";
class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>

3) Here's the services.mxml remote object:
<cairngorm:ServiceLocator
xmlns:cairngorm="com.adobe.cairngorm.business.*"
xmlns:mx="http://www.adobe.com/2006/mxml";>

<mx:RemoteObject
id="roAMFPHPService"
destination="AMFPHPDestination"
source="AccountService"
showBusyCursor="true">
<mx:method name="checkLogin" />
</mx:RemoteObject>
</cairngorm:ServiceLocator>

4) And the relevant parts of the login delegate which calls:
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;

public class LoginDelegate
{
protected var service:RemoteObject;
protected var responder:Responder;

public function LoginDelegate(p_responder:Responder)
{
trace("LoginDelegate::constructor");

responder = p_responder;
service = ServiceLocator.getInstance().getService("AMFPHPDestination")
as RemoteObject;
}

public function CheckLogin():void {
trace("LoginDelegate::CheckLogin function - " + p_AttemptedUser.UserID);
service.addEventListener(ResultEvent.RESULT, CheckLogin_onResult);
service.addEventListener(FaultEvent.FAULT, CheckLogin_onFault);
service.checkLogin("UsernameTest", "PasswordTest");
}

protected function CheckLogin_onResult(event:ResultEvent):void
{
trace("LoginDelegate::CheckLogin_onResult - Output");
trace(event.result);
responder.onResult(new ResultEvent(ResultEvent.RESULT, false, true,
event.result));
service.removeEventListener(ResultEvent.RESULT, CheckLogin_onResult);
service.removeEventListener(FaultEvent.FAULT, CheckLogin_onFault);
}

And I receive the error "Destination 'AMFPHPDestination' must specify
at least one adapter." The php service isn't anything special, just
give username / pass, validate in query to the mySQL DB and return a
specific data element if valid. I know from ServiceCapture and the
other version that I don't have an issue on that side.

Much thanks!
Jamie

--- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Patrick
Mineault"
<[EMAIL PROTECTED]> wrote:
>
> Could you post the services_config.xml file you have?
>
> Patrick
>
> 2006/12/18, Jamie O <[EMAIL PROTECTED]>:
> >
> > Hello,
> >
> > I am able to do a stand-alone .mxml project using the samples you have
> > provided and connect well to my php methods / backend database. The
> > issue I have is when trying to deploy this as part of a Flex Data
> > Services / Cairngorm app I can't get the remote object to allow
> > compile or usage without error.
> >
> > Anyone have a cairngorm / FDS scope example for using AMFPHP 1.9?
> >
> > If I do the closest equivelent of adding the relevant contents of your
> > services-config.mxml to the already created one for FDS I get a
> > "Destination 'AMFPHPDestination' must specify at least one adapter"
> > error message when starting the server (Tomcat 5.5)
> >
> > If I do a purely-client side entry of the endpoint in the
> > services.mxml instantiation I get other errors - and this is also not
> > a way I want to go as the endpoint URL would be exposed.
> >
> > Renaud's examples don't seem to include cairngorm-ified versions as
> > was the case in the past and I haven't managed to crack this nut.
> >
> > Thx,
> > Jamie
> >
> > --- In flexcoders@yahoogroups.com 
<flexcoders%40yahoogroups.com><flexcoders%40yahoogroups.com>,

Patrick
> > Mineault
> > <patrick.mineault@> wrote:
> > >
> > > Hi all,
> > >
> > > I've finally gotten around to add AMF3 support to amfphp, so you can
> > > finally use Flex 2's RemoteObject with it. To test the new features,
> > > I've created a new Service Browser in Flex 2 which allows you to
> > > introspect services and test methods on the fly. I need people
to test
> > > out the new AMF3 support.
> > >
> > > New/changed features:
> > >
> > > - $this->methodTable is DEAD. All methods in /services are now
> > > considered remotely accessible, unless you set them to protected or
> > > private (PHP5) or start the method name with an (_), in which
case it
> > > will throw an error. If you want to get a description of a
method and
> > > it's arguments without looking at the class itself, add JavaDoc
to the
> > > method and you should see it in the new Service Browser.
> > > - _authenticate is dead, as a side-effect of the removal of the
> > > methodTable. You can secure methods by creating a special function
> > > called "beforeFilter($methodName)" in your class and return false to
> > > stop a method from being executed. (the _ and the beforeFilter
are the
> > > conventions used by CakePHP, so I figured I'd use those instead of
> > > rolling my own).
> > > - Circular references in AMF0 and AMF3 should now work. Class
mapping
> > > code has been ported to the AMF3 code also. To use remote class
> > mapping,
> > > use registerClassAlias or the [RemoteClass] metadata tag, then
read the
> > > instructions in advancedsettings.php
> > > - Returning a mysql_query will now return either an Array or an
> > > ArrayCollection depending on the setting in gateway.php. Other
database
> > > types are currently unsupported in AMF3 mode (they will be
supported as
> > > soon as I am sure the AMF3 code is perfect).
> > > - You can send ByteArray, ArrayCollection and ObjectProxy
instances as
> > > arguments to remote methods. You will receive the result as a
> > string, as
> > > the inner array and as the inner object, respectively. Currently
there
> > > is no way to send back these types to Flash, but there will be
in the
> > > next version.
> > > - /browser now brings up the brand spanking new Flex 2-based service
> > > browser. You can test methods directly through it. If the method
> > returns
> > > an array or arraycollection, the browser will attempt to show it
in a
> > > datagrid (sweet). Please feel free to modify servicebrowser.mxml
(it's
> > > very spaghetti-code-ish, but it works). You will need the Adobe
corelib
> > > to compile (google for the link)
> > >
> > > Limitations/things to keep in mind:
> > >
> > > - MySql works but not other databases
> > > - You can use a JSON string for arguments in the service browser.
> > > However you must wrap object keys in quotes (a limitation of Adobe
> > corelib).
> > > - Paged recordsets don't work anymore
> > > - Only tested in PHP5. PHP4 might show issues with circular
references.
> > > - Calling two methods on a remoteObject one after the other
(during the
> > > same frame) might not work.
> > > - Charles and ServiceCapture have some issues with AMF3
handling. You
> > > might see strings which seem out of place in your output while
it works
> > > fine in Flash. I will notify the people involved. You might want
to set
> > > PRODUCTION_SERVER to true in gateway.php if this is a recurrent
> > problem,
> > > in the meantime.
> > > - If you need to send to Flash a class and want it to be mapped to a
> > > class in a package, you need to add a key to the class called
> > > _explicitType with a value of "com.mypackage.TheClass" and use
> > > registerClassAlias or [RemoteClass] as usual ( a limitation of
php not
> > > supporting packages)
> > >
> > > All that being said, I need testers. Please download it here:
> > >
> > > http://5etdemi.com/uploads/amfphp-1.9.alpha.zip
> > >
> > > (although it states it is amfphp 1.9, there will be no amfphp 1.9.
> > > amfphp 2.0 will be amfphp 1.9 + JSON and possibly XML-RPC)
> > >
> > > If you run into any issues, please either:
> > >
> > > - Create a minimal test case which shows the reproducible bug, then
> > send
> > > it to me.
> > > - In gateway.php, uncomment $gateway->logIncomingMessages and
> > > logOutgoingMessages, create an in and an out folder and run it
again.
> > > Then send the log files (*.amf) to me.
> > >
> > > Please send the feedback to pm AT 5etdemi DOT com. I am confident it
> > > should be pretty stable, as most of the new code is lifted from
> > > Fluorine, but you never know. Once I am 100% sure the amf 3 code is
> > > bulletproof I will release another version with some publicity
on the
> > > blog and the homepage (currently keeping the new code low-profile).
> > >
> > > Thanks,
> > >
> > > Patrick
> > >
> >
> >
> >
>

Reply via email to