I have defined a web service to return information from a database as
follows.
class BackendApi < ActionWebService::API::Base
api_method :find_all_vobs,
:returns => [[:int]]
api_method :find_vob_by_id,
:expects => [:int],
:returns => [Vob]
class BackendController < ApplicationController
wsdl_service_name ‘Backend’
web_service_scaffold :invoke
def find_all_vobs
Vob.find(:all).map{ |v| v.id }
end
def find_vob_by_id(id)
Vob.find(id)
end
end
mysql> describe vobs;
±------------------------±--------------±-----±----±--------------------±---------------+
| Field | Type | Null | Key | Default
| Extra |
±------------------------±--------------±-----±----±--------------------±---------------+
| id | int(11) | | PRI | NULL
| auto_increment |
| replica_family_uuid | varchar(100) | | |
| |
| created_by | varchar(100) | | |
| |
| created_on | datetime | | | 0000-00-00
00:00:00 | |
| server_host | varchar(50) | | |
| |
| tag | varchar(50) | | |
| |
| replica_name | varchar(150) | | |
| |
| master_replica | varchar(150) | | |
| |
| region | varchar(50) | | |
| |
| owner | varchar(20) | | |
| |
| primary_group | varchar(20) | | |
| |
| feature_level | varchar(5) | | |
| |
| database_schema_version | varchar(5) | | |
| |
| access | varchar(10) | | |
| |
| identity_preserving | tinyint(1) | | | 0
| |
| permission_preserving | tinyint(1) | | | 0
| |
| replica_names | text | | |
| |
| global_path | varchar(150) | | |
| |
| space_used | decimal(10,2) | | | 0.00
| |
±------------------------±--------------±-----±----±--------------------±---------------+
19 rows in set (0.00 sec)
When I connect via http://localhost:3000/backend/invoke (using the web
service scaffolding) FindAllVobs works as expected, but FindVobById
returns an error as seen below. The date that “parse” is puking on in
the database is set to ‘2001-10-15 10:41:41’.
ArgumentError in Backend#invoke_submit
invalid date
c:/ruby/lib/ruby/1.8/date.rb:1214:in new_with_hash' c:/ruby/lib/ruby/1.8/date.rb:1258:in
parse’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:103:in
cast_base_type' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:62:in
cast’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:123:in
cast_to_structured_type' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:121:in
each_member’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/support/signature_types.rb:205:in
each' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/support/signature_types.rb:205:in
each_member’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:121:in
cast_to_structured_type' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:60:in
cast’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:38:in
cast_returns' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/casting.rb:25:in
cast_returns’
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/api.rb:193:in
cast_returns' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0.4008/lib/action_web_service/dispatcher/abstract.rb:182:in
web_service_create_response’
.
.
.
The book Agile Web D. with Rails seems to indicate that this
should just work the way I have set it up. Does anyone have any
suggestions as to what I should be looking for to solve this? I’m
running the Rails 1.1 candidate from the gems on Windows XP with Ruby
1.8.2.
Thanks,
Justin