<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>publicreative lab &#187; zend</title>
	<atom:link href="http://lab.publicreative.com/tag/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.publicreative.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 15:59:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AMF command line utility</title>
		<link>http://lab.publicreative.com/2009/03/amf-command-line-utility/</link>
		<comments>http://lab.publicreative.com/2009/03/amf-command-line-utility/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 14:23:07 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[amf]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=91</guid>
		<description><![CDATA[We do a lot of projects with AMF at Public, and historically we&#8217;ve used amfphp on our back end. On a current project however we are using Zend framework. The Zend_AMF module is the successor of the original amfphp project, but it is missing one really useful thing &#8211; it doesn&#8217;t have a service browser [...]]]></description>
			<content:encoded><![CDATA[<p>We do a lot of projects with <a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">AMF</a> at Public, and historically we&#8217;ve used <a href="http://www.amfphp.org/">amfphp</a> on our back end. On a current project however we are using <a href="http://framework.zend.com/">Zend framework</a>. The <a href="http://framework.zend.com/manual/en/zend.amf.html">Zend_AMF</a> module is the successor of the original amfphp project, but it is missing one really useful thing &#8211; it doesn&#8217;t have a service browser like amfphp does. I appreciate that there is fairly good reason for this, but it is a super handy tool we&#8217;ve come quite used to having available.</p>
<p><strong>So what&#8217;s the problem?</strong></p>
<p>If your PHP developers  have to start work before your Flash developers, you may find yourself with a back end, but no front end, so how do you test everything works? Moreover, how do you develop the back end at all if you can&#8217;t send and receive requests from your AMF gateway?</p>
<p>I wrote a simple command line tool for testing AMF calls, so I thought I&#8217;d share it with you here:<br />
<a href="http://lab.publicreative.com/wp-content/uploads/2009/03/amf.tgz"><strong>Download the amf command line program</strong></a>, requires PHP 5.2 with the json extension enabled.</p>
<p>It&#8217;s a fairly crude tool, and cannot support class mapping, but it&#8217;s currently helping us out very nicely. If you like it, or would like to see any improvements, please post a comment.</p>
<p><span id="more-91"></span><strong>Usage</strong>:</p>
<p>Download and make sure you can execute the program</p>
<pre>&gt; wget http://lab.publicreative.com/wp-content/uploads/2009/03/amf.tgz
&gt; tar -xvzf amf.tgz
&gt; chmod u+x amf</pre>
<p>For each service you want to test, create a file containing three lines.<br />
1. The URL of your AMF service gateway<br />
2. The method you want to call, &lt;service&gt;.&lt;method&gt;<br />
3. The arguments to post to the service as a JSON array. This may go onto multiple lines</p>
<p>Here&#8217;s the bundled example in <em>example_test.txt</em></p>
<pre>http://mydomain.com/my/amf/gateway
MyServiceClass.MyMethod
[
  "Arguments in JSON format",
  "always as an array",
  { "objects": "are also legal" }
]</pre>
<p>To execute this test, pipe the file into the amf program as stdin, e.g.<code><br />
&gt; cat example_test.txt | ./amf</code></p>
<p>You should see the deserialized arguments you are about to post, then a hex dump of the request packet, and then hopefully the response, followed by the deserialized response data.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/03/amf-command-line-utility/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

