On Fri, Aug 24, 2007 at 07:04:32PM +0200, Nicolas Raspail wrote: > >From Joe Landman (Sun, 22 Jul 2007) > > > >Hi folks: > > > >Using XMLRPC for some service method calls to make life > >"easier"/cleaner for some of our code. I am doing something wrong, as > I >get errors (at the end). > > > > I set up a simple application using the usual methods > > > > catalyst.pl RDB > > cd RDB > > script/rdb_create.pl controller Job > > > >I then set about to use portions of the examples in the > >Catalyst::Plugin::Server::XMLRPC . Specifically I created a ping and > >echo method, to test. I placed these in the Job.pm (rather than > Root.pm >... is this an issue?). This is what they look like. > > > > > >sub echo : XMLRPC { # available as: job.echo > > my ( $self, $c, @args ) = @_; > > $c->stash->{xmlrpc} = join ', ', @args; > > $c->log->debug($args[0]); > > } > > > >sub ping : XMLRPCPath('/job/ping') { # available as: ping > > my ( $self, $c ) = @_; > > $c->stash->{xmlrpc} = 'Pong'; > > } > > > >Ok. Light up the server, comes up fine: > > > >[EMAIL PROTECTED]:~/remote_db_access/RDB$ script/rdb_server.pl > >[debug] Debug messages enabled > >[debug] Loaded plugins: > >.----------------------------------------------------------------------------. > >| Catalyst::Plugin::ConfigLoader 0.14 | | Catalyst::Plugin::Server > 0.24 >| | Catalyst::Plugin::Server::XMLRPC | | > >Catalyst::Plugin::Static::Simple 0.17 | > >'----------------------------------------------------------------------------' > > > >... > > > >[debug] Loaded Private actions: > >.----------------------+--------------------------------------+--------------. > >| Private | Class | Method | > >+----------------------+--------------------------------------+--------------+ > >| /end | RDB::Controller::Root | end | | /job/ping | > >RDB::Controller::Job | ping | | /job/echo | RDB::Controller::Job | > echo >| > >'----------------------+--------------------------------------+--------------' > >... > >[debug] Loaded XMLRPCPath Method actions: > >.--------------------------------------+---------------------------------------. > >| XMLRPCPath Method | Private | > >+--------------------------------------+---------------------------------------+ > >| job.echo | /job/echo | | job.ping | /job/ping | > >'--------------------------------------+---------------------------------------' > > > > > >Now try the echo call: > > > >[EMAIL PROTECTED]:~$ rpc_client -u http://localhost:3000/rpc -m > >/job/echo \ > > abcd 123 > > > >I get this on the client side: > > > >-----------------Output----------- > >$VAR1 = { > > 'faultString' => 'Internal Server Error', > > 'faultCode' => '500' > > }; > > > > > >And I get this on the server side: > > > >[info] RDB powered by Catalyst 5.7007 > >You can connect to your server at http://balto:3000 > >[info] *** Request 1 (0.011/s) [10821] [Sun Jul 22 23:05:27 2007] *** > >[debug] "POST" request for "rpc" from "127.0.0.1" > >[debug] XML-RPC: Method called: /job/echo > >[debug] Path is "job/echo" > >[debug] abcd > >[debug] XMLRPC 500 Errors: > >Caught exception in RDB::Controller::Root->end > >"Catalyst::Action::RenderView could not find a view to forward to." > >[info] Request took 0.134054s (7.460/s) > >.----------------------------------------------------------------+-----------. > >| Action | Time | > >+----------------------------------------------------------------+-----------+ > >| /job/echo | 0.000191s | | /end | 0.001559s | > >'----------------------------------------------------------------+----------- > > > >Basically it is telling me that it doesn't have a view to forward to. > >Is this needed in Server::XMLRPC ? I thought it did html encapsulated > >XML ... no view needed. > > > >Any thoughts/clues? Thanks. > > > >Joe > > Hello, > > when playing with Catalyst::Plugin::Server::XMLRPC following the > documentation, I get the same behaviour as Joe. > > I have search the archive and found thie mail from Joe Landman , and he > has the same problem, but unfortunately, nobody answer him. > > I have copy/paste his email because his setup and mine are the same, and > I don't have my script available right now. > > To get my app running, at the end of my RPC function, I must put an > $c->output(' '). > > I would like to know if it is the correct thing to do, or I'm doing > something wrong.
I'd do - sub end :Private { my ($self, $c) = @_; $c->forward('render') unless $c->req->xmlrpc->is_xmlrpc_request; } sub render :ActionClass('RenderView') { } Seems a bit cleaner than your approach. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director Want a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/ _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/