<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How Easy Are Web Services in CakePHP 1.2?  Really Easy!</title>
	<atom:link href="http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/</link>
	<description>Facebook should&#039;ve be written in unicornSchemaLang, because everyone *knows* that PHP is no good for anything, right?</description>
	<lastBuildDate>Mon, 09 Aug 2010 16:04:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: [PRONIQUE] CakePHP Developer Links</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-12412</link>
		<dc:creator>[PRONIQUE] CakePHP Developer Links</dc:creator>
		<pubDate>Thu, 23 Jul 2009 16:59:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-12412</guid>
		<description>[...] How Easy Are Web Services in CakePHP 1.2? Really Easy! — @TheKeyboard [...]</description>
		<content:encoded><![CDATA[<p>[...] How Easy Are Web Services in CakePHP 1.2? Really Easy! — @TheKeyboard [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ?????????????? ????????? sitemap.xml ? CakePHP 1.2 &#124; Bunyan.Ru</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-11069</link>
		<dc:creator>?????????????? ????????? sitemap.xml ? CakePHP 1.2 &#124; Bunyan.Ru</dc:creator>
		<pubDate>Thu, 04 Dec 2008 13:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-11069</guid>
		<description>[...] ???????, ????? ????????? ???????? ????????? ?? Chris Hartjes ??? ????????? ????? [...]</description>
		<content:encoded><![CDATA[<p>[...] ???????, ????? ????????? ???????? ????????? ?? Chris Hartjes ??? ????????? ????? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Weaver</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-11068</link>
		<dc:creator>Rob Weaver</dc:creator>
		<pubDate>Wed, 03 Dec 2008 18:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-11068</guid>
		<description>Hey Chris, as always your post is very helpful.

I do have a question though: What would be a good approach for detecting if the request is expecting to return the XML content instead of an HTML document?

For instance, if I have a index action on my Users, I want it to return the normal XHTML for the web browser, but for a web service, I need it to return XML.

In that case, would the approach be to simply use the index.xml convention, or would you suggest building a &quot;rest&quot; action that returns the data you care about?</description>
		<content:encoded><![CDATA[<p>Hey Chris, as always your post is very helpful.</p>
<p>I do have a question though: What would be a good approach for detecting if the request is expecting to return the XML content instead of an HTML document?</p>
<p>For instance, if I have a index action on my Users, I want it to return the normal XHTML for the web browser, but for a web service, I need it to return XML.</p>
<p>In that case, would the approach be to simply use the index.xml convention, or would you suggest building a &#8220;rest&#8221; action that returns the data you care about?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-9738</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Thu, 01 May 2008 12:38:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-9738</guid>
		<description>@Phil

If by &quot;real web service&quot; you mean &quot;script that spits out something other than HTML upon request&quot; then the answer is yes.  I have web services that feed data to a companion site for my simulation baseball league.  Nothing fancy like XML or JSON, just text formatted in a specific way.

None of the presentations from CakeFest have made their way out on the web as far as I know.</description>
		<content:encoded><![CDATA[<p>@Phil</p>
<p>If by &#8220;real web service&#8221; you mean &#8220;script that spits out something other than HTML upon request&#8221; then the answer is yes.  I have web services that feed data to a companion site for my simulation baseball league.  Nothing fancy like XML or JSON, just text formatted in a specific way.</p>
<p>None of the presentations from CakeFest have made their way out on the web as far as I know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Taylor</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-9727</link>
		<dc:creator>Phil Taylor</dc:creator>
		<pubDate>Thu, 01 May 2008 10:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-9727</guid>
		<description>So have you developed any real wed services with CakePHP?

Also, Nate gave a presentation at the CakeFest on REST webservices and CakePHP. Is this available for public consumption?</description>
		<content:encoded><![CDATA[<p>So have you developed any real wed services with CakePHP?</p>
<p>Also, Nate gave a presentation at the CakeFest on REST webservices and CakePHP. Is this available for public consumption?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DieHard</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-9043</link>
		<dc:creator>DieHard</dc:creator>
		<pubDate>Wed, 16 Apr 2008 12:15:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-9043</guid>
		<description>Chris, can you show us how you do web services with JSON? And, also how to do session with web services? Please! :)

Thanks for the help!</description>
		<content:encoded><![CDATA[<p>Chris, can you show us how you do web services with JSON? And, also how to do session with web services? Please! <img src='http://www.littlehart.net/atthekeyboard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks for the help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rdeman</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-8860</link>
		<dc:creator>rdeman</dc:creator>
		<pubDate>Tue, 25 Mar 2008 19:20:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-8860</guid>
		<description>so how does this work when I want to post arguments?
http://localhost/cake_dev/foo/index.xml/argumentg1/argument2/ ??</description>
		<content:encoded><![CDATA[<p>so how does this work when I want to post arguments?<br />
<a href="http://localhost/cake_dev/foo/index.xml/argumentg1/argument2/" rel="nofollow">http://localhost/cake_dev/foo/index.xml/argumentg1/argument2/</a> ??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-8246</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Tue, 04 Dec 2007 18:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-8246</guid>
		<description>@Tim
Well, the main reason is so that I don&#039;t actually have to generate the XML myself, instead getting Cake to do it for me.  Keep in mind that some of this stuff may have changed since this tutorial was written, maybe I need to go back and see what still holds true...</description>
		<content:encoded><![CDATA[<p>@Tim<br />
Well, the main reason is so that I don&#8217;t actually have to generate the XML myself, instead getting Cake to do it for me.  Keep in mind that some of this stuff may have changed since this tutorial was written, maybe I need to go back and see what still holds true&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Daldini</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-8237</link>
		<dc:creator>Tim Daldini</dc:creator>
		<pubDate>Tue, 04 Dec 2007 01:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-8237</guid>
		<description>If you only need the foo method to spit out xml, is there any point in calling parseExtensions() in the first place? Just wondering.</description>
		<content:encoded><![CDATA[<p>If you only need the foo method to spit out xml, is there any point in calling parseExtensions() in the first place? Just wondering.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: T0aD</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/comment-page-1/#comment-7701</link>
		<dc:creator>T0aD</dc:creator>
		<pubDate>Sat, 06 Oct 2007 13:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/#comment-7701</guid>
		<description>I was looking for a generic way to handle different extensions using Router::parseExtensions() and unfortunately extensions like rest (which used to be a web service routed just fine in cake 1.1) are not supported (you can have a look at RequestHandler::__requestContent to see which extensions are correctly supported under cakephp 1.2).

I didn&#039;t like your way to do it as well, since it means to do it manually in each method you want to export as a webservice, so I implemented it using the beforeFilter() hook:

class WebsitesController extends AppController {
  var $name = &#039;Websites&#039;;
  var $uses = array(&#039;Website&#039;);

  function beforeFilter() {
    if (isset($this-&gt;params[&#039;url&#039;][&#039;ext&#039;]) &amp;&amp;
         strlen($this-&gt;params[&#039;url&#039;][&#039;ext&#039;])) {
       $this-&gt;viewPath .= DS . $this-&gt;params[&#039;url&#039;][&#039;ext&#039;];
       $this-&gt;layoutPath = $this-&gt;params[&#039;url&#039;][&#039;ext&#039;];
       /* We don&#039;t want to have time in the end of our REST response for instance */
       Configure::write(&#039;debug&#039;, 0);
    }
    parent::beforeFilter();
  }

  function count() {
   $this-&gt;set(&#039;numberWebsites&#039;, $this-&gt;Website-&gt;findCount());
}

Simply call http://www.example.com/websites/count.rest


This wasn&#039;t fully tested so any feedback are welcome.</description>
		<content:encoded><![CDATA[<p>I was looking for a generic way to handle different extensions using Router::parseExtensions() and unfortunately extensions like rest (which used to be a web service routed just fine in cake 1.1) are not supported (you can have a look at RequestHandler::__requestContent to see which extensions are correctly supported under cakephp 1.2).</p>
<p>I didn&#8217;t like your way to do it as well, since it means to do it manually in each method you want to export as a webservice, so I implemented it using the beforeFilter() hook:</p>
<p>class WebsitesController extends AppController {<br />
  var $name = &#8216;Websites&#8217;;<br />
  var $uses = array(&#8216;Website&#8217;);</p>
<p>  function beforeFilter() {<br />
    if (isset($this-&gt;params['url']['ext']) &amp;&amp;<br />
         strlen($this-&gt;params['url']['ext'])) {<br />
       $this-&gt;viewPath .= DS . $this-&gt;params['url']['ext'];<br />
       $this-&gt;layoutPath = $this-&gt;params['url']['ext'];<br />
       /* We don&#8217;t want to have time in the end of our REST response for instance */<br />
       Configure::write(&#8216;debug&#8217;, 0);<br />
    }<br />
    parent::beforeFilter();<br />
  }</p>
<p>  function count() {<br />
   $this-&gt;set(&#8216;numberWebsites&#8217;, $this-&gt;Website-&gt;findCount());<br />
}</p>
<p>Simply call <a href="http://www.example.com/websites/count.rest" rel="nofollow">http://www.example.com/websites/count.rest</a></p>
<p>This wasn&#8217;t fully tested so any feedback are welcome.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
