On Thu, Apr 9, 2009 at 10:00 AM, Bruce McKenzie <span dir="ltr">&lt;<a href="mailto:brucem@dynamicrange.com">brucem@dynamicrange.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">I have a newly developed RESTful interface to an existing server using C::C::REST. Works nicely -- Catalyst is a very nice tool, and the REST extensions are very helpful.<div><br></div><div>The server has existing services that are orthogonal to the RESTful interface. I don&#39;t really wish to RESTify them so I&#39;d like to expose them as XML-RPC.</div>
<div><br></div><div>Per the tutorial (<a href="http://search.cpan.org/%7Emichiel/Catalyst-Plugin-Server-0.24/lib/Catalyst/Plugin/Server/XMLRPC/Tutorial.pod" target="_blank">http://search.cpan.org/~michiel/Catalyst-Plugin-Server-0.24/lib/Catalyst/Plugin/Server/XMLRPC/Tutorial.pod</a> ) I added &quot;Server Serve::XMLRPC&quot; to my &quot;use Catalyst&quot; line.</div>
<div><br></div><div>I now receive this:</div><div>-------</div><div><div>RestRPC has a custom request class Catalyst::Plugin::Server::Request, which is not a Catalyst::Request::REST; see Catalyst::Request::REST at /Library/Perl/5.8.8/Catalyst/Request/REST.pm line 29.</div>
<div>Compilation failed in require at script/restrpc_server.pl line 55.</div><div>-------</div><div><br></div><div>I see this in the REST doc:</div><div>-------</div><div><div>Note that if you have a custom request class in your application, and it does</div>
<div>not inherit from C&lt;Catalyst::Request::REST&gt;, your application will fail with an</div><div>error indicating a conflict the first time it tries to use</div><div>C&lt;Catalyst::Request::REST&gt;&#39;s functionality.  To fix this error, make sure your</div>
<div>custom request class inherits from C&lt;Catalyst::Request::REST&gt;.</div><div>-------</div><div>but that doesn&#39;t seems like an option here. (These are peers, not parent/child classes)</div><div><br></div></div><div>
Am I missing something obvious?</div><div><br></div><div>Is there another way to do XML-RPC + REST?</div><div><br></div><div>Seems like I could just handle the POSTs with non-ActionClass(&#39;REST&#39;) methods -- but then it becomes &quot;not quite XML-RPC&quot;.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Bruce</div><div><br></div><div> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="">
<div>---</div><div>Bruce McKenzie</div><div><a href="mailto:brucem@dynamicrange.com" target="_blank">brucem@dynamicrange.com</a></div><div><br></div></div></span><br> </div><br></div></div><br>_______________________________________________<br>

List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
<br></blockquote></div><br><br clear="all">Well, the problem is the two request classes are just fighting and the Plugin clobbers it first.  The easy solution that I can think of would be to create a custom request class that looks like:<br>
<br><pre>package MyApp::Request::XMLRPCwithREST;<br><br>    use strict;<br>    use warnings;<br><br>    use base qw/Catalyst::Request::REST Class::Accessor::Fast/;<br><br>    *params = *parameters;<br><br>    sub register_server {<br>
        my ($self, $name, $class) = @_;<br>        return unless ($name &amp;&amp; $class);<br><br>        $self-&gt;mk_accessors($name);<br>        $self-&gt;$name($class);<br>    }<br><br></pre>Then, after that you just modify the plugins ReqClass to point to yours (in MyApp.pm):<br>
<br>$Catalyst::Plugin::Server::ReqClass = &#39;MyApp::Request::XMLRpcwithREST&#39;;<br><br>This is all just a speculative solution, but I believe it would work for you.  You&#39;re definitely in edge-case territory though.<br>
<br>-J<br><br>