Forums / Developer / Extension with Zend AMF Server

Extension with Zend AMF Server

Author Message

Arnoud van Steen

Tuesday 14 April 2009 7:56:11 am

Hello,

I've been working on an extension for Ez Publish that allows me to let Flex communicate with Ez Publish. I've got it working, after some struggles, using Ez Publish 4.1 and Zend AMF Server.

But in order to get responses back from Ez Publish I've had to change the index.php file where at the very end where the echo happens of the output ($out) the php function "trim" is used to get rid of any whitespaces around the output.
Apparently, this trim function removes a vital character for the response of the Zend AMF Server as I only had to remove this trim call in order to get the communication working properly.

Can this be regarded as an issue? :) I wonder why that trim is even there as browsers should have no problem with a little whitespacing around the output. But it obviously poses a problem for using Zend AMF Server with Ez Publish.
Itsnot cool to have to change any files from Ez Publish itself with each update / reinstall.

Regards

Patrick Kaiser

Tuesday 14 April 2009 10:01:08 am

Do you plan to release your extension to projects.ez.no? I would be very interested.


Best regards,

Patrick

André R.

Wednesday 15 April 2009 2:02:34 am

You should create an issue for this.
But not sure we can just remove it, it's there for a reason.

Doesn't 'some' browsers fall back to quirks mode if there is anything before doctype tag in html?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Arnoud van Steen

Wednesday 15 April 2009 7:32:30 am

Alright, I will create an issue for this.

I'm interested to know why the trim function is used there. :)

@Patrick: not sure at the moment. The result will have to be of good quality first.

Damien Pobel

Thursday 16 April 2009 2:33:37 pm

<i>Doesn't 'some' browsers fall back to quirks mode if there is anything before doctype tag in html?</i>

that's true but IMHO if you have such a problem you should fix your templates. You can imagine cases where you want to output some spaces at the beginning or the end of the output.
It seems that this "feature" was added in revision 19872 but the commit log doesn't help a lot.

$ svn -v log -r 19872 index.php 
------------------------------------------------------------------------
r19872 | kk | 2007-09-07 12:02:28 +0200 (ven 07 sep 2007) | 3 lines
Chemins modifiés :
   M /unstable/2007-03-21-php5/index.php

- Trimmed text in output buffer. This is required to return content of type, 
  Content-Type: application/xml  .

------------------------------------------------------------------------

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

André R.

Friday 17 April 2009 3:07:51 am

Yes, most xml parsers will not validate the xml if it starts or stops with with space.

Anyway, this is a non issue if you exit your extension view properly (I guess you don't need pagelayout for this view anyway?..)

    echo 'Hi mom!';

    eZDB::checkTransactionCounter();
    eZExecution::cleanExit();

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Arnoud van Steen

Friday 17 April 2009 4:38:18 am

Sweet, adding that to the extension allows me to leave index.php untouched. Thanks for that :)

Indeed pagelayout is disabled as I dont want any other output but that from the Zend AMF Server.

This shows one thing I find problematic when developing on Ez Publish though, where could I have found out, in documentation, how to properly exit the extension view?
It seems stuff like this you need to run into, then ask a question and thus the answer appears.
I've seen the articles (and thus knew how to create an extension), the api (which has very little useful info), the technical documentation, which is decent.

Am I missing an important source of information somewhere?

André R.

Friday 17 April 2009 5:48:30 am

No, I'm afraid that the best source for information for eZ Publush php development currently is (in random order):
1. look at code in other extensions
2. search in forum for what your trying to do, in this case this has been mentioned in several 'ajax view' / 'ajax module' posts
3. take a look at ezpedia.org

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Jérôme Vieilledent

Monday 25 May 2009 4:05:48 am

Hi

I have developped an extension to communicate with AMF (Zend_AMF) and I'm about to release it on projects.ez.no. It's called <b>jvAMF</b>

It's quite simple an do not need kernel hack. As far as I know, Flash Player ignores everything that's after the AMF content. It works well with the debug on, but fails with template debug (with the inline comments).

Next step is to develop a service debugger for the admin, which can be quite tough...

Gaetano Giunta

Monday 25 May 2009 7:43:08 am

@jv:

<i>fails with template debug (with the inline comments)</i>
If that means using "|attribute(show)" in your templates, I'd recommend installing instead the ezdebug extension, which routes debug calls from within templates into the standard debug panel / log system.

<i>Next step is to develop a service debugger for the admin, which can be quite tough... </i>
Might be worth looking at ggwebservices extension. It has a ws debugger, even though it only supports xmlrpc and jsonrpc for now.

Principal Consultant International Business
Member of the Community Project Board

Jérôme Vieilledent

Monday 25 May 2009 7:53:35 am

Hi Gaetano

I didn't know about this extension <i>ezdebug</i>, I'll check, thanks.
I've looked at your extension, nice :-). What I would like to do is to try to implement the AMF service debugger from AMFPHP with Zend AMF

Arnoud van Steen

Monday 25 May 2009 9:56:24 am

Interesting, let me know when you have released it! :)

Heath

Tuesday 26 May 2009 1:44:07 am

There exists an older (2007/php5/ez4) example extension which provided amfphp which can be used with eZ Publish via php to provide data to flash using the AMF protocol.

<i>http://projects.ez.no/remoting
http://svn.projects.ez.no/remoting/trunk/extension/remoting/
http://ezpedia.org/ez/remoting
http://www.amfphp.org/about.html</i>

It even comes with the initial examples and detailed installation instructions.

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Jérôme Vieilledent

Thursday 18 June 2009 10:33:58 am

Hi all !
I just released my extension jvAMF. You can check it out at http://projects.eZ.no/jvamf .
A little addendum to the doc : you need to point your Flex Remote Objects to http://your-server-host/jvamf/endpoint

Feel free to post your reviews on the project forum !
Cheers