Hi, I'm having some issues with Java/Rails XML-RPC communication. Has anyone tried this?
For testing, I'm just trying to make a 0-argument request, and receive an integer response. I know that the rails app works fine - I have a number of working controllers on it already.
--Java Client-- For the Java client, I'm using the Apache XML-RPC client (ws-xmlrpc - Apache XML-RPC). The code is:
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://pdbrs3.sdsc.edu/ContactMap/ce_mc_alignment/request"\)); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Integer result = (Integer) client.execute("blah", new Object{}); System.out.print(result);
--Rails-- For Rails, I did "script/generate webservice ce_mc_alignment request". This generated a controller and a web service api. I modified them as follows:
class CeMcAlignmentController < ApplicationController wsdl_service_name 'CeMcAlignment'
def request 154 end end
class CeMcAlignmentApi < ActionWebService::API::Base api_method :request, :returns => [{:jobID => :int}] end
--Server configuration-- I use Lighttpd, with multiple Rails apps. The /ContactMap/ in the url above reflects this.
--Error-- When I run the Java code, I get a server response of 500. The development.log file says:
Processing Base#request (for 69.241.224.210 at 2006-08-25 19:10:40) [POST] Session ID: 587399584c8e56b65a4bfbc85e18b9ab Parameters: {"action"=>"request", "controller"=>"ce_mc_alignment", "methodCall"=>{"methodName"=>"blah", "params"=>nil}}
ArgumentError (wrong number of arguments (0 for 1)): /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controlle r/base.rb:902:in `method'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controlle r/base.rb:902:in `log_processing'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controlle r/base.rb:380:in `process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controlle r/filters.rb:377:in `process_without_session_management_support' ...