Hi,
I''m having difficulties creating SOAP methods using ActionWebService
which have dates/times as direct parameters or as part of a struct. The
problem can be reproduced using the following simple test case:
Controller:
class TestAPI < ActionWebService::API::Base
api_method :test_time, :expects => [{:param => :time}]
end
class TestController < ApplicationController
wsdl_service_name ''Test''
web_service_api TestAPI
def test_time(param)
end
end
Client:
require ''test_api''
stub = ActionWebService::Client::Soap.new(TestAPI,
"http://localhost:3000/test/api")
stub.test_time(Date.today)
This results into the following stack trace (client side):
NoMethodError: private method `hour'' called for #<Date:
4906919/2,0,2299161>
from c:/Ruby/lib/ruby/1.8/xsd/datatypes.rb:611:in `_to_s''
from c:/Ruby/lib/ruby/1.8/xsd/datatypes.rb:149:in `to_s''
from
c:/Ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:64:in `encod
e_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:93:in
`encode_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:95:in
`encode_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:93:in
`encode_data''
from
c:/Ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:67:in `each''
from c:/Ruby/lib/ruby/1.8/soap/rpc/element.rb:189:in
`each_param_name''
from c:/Ruby/lib/ruby/1.8/soap/rpc/element.rb:105:in `each''
from c:/Ruby/lib/ruby/1.8/soap/rpc/element.rb:105:in
`each_param_name''
from c:/Ruby/lib/ruby/1.8/soap/rpc/element.rb:189:in `each''
from
c:/Ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:67:in `encod
e_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:93:in
`encode_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:114:in
`encode_element''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:112:in `encode''
from c:/Ruby/lib/ruby/1.8/soap/element.rb:112:in `each''
... 3 levels...
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:129:in
`encode_element''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:127:in `encode''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:127:in
`encode_element''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:65:in
`encode_data''
from c:/Ruby/lib/ruby/1.8/soap/generator.rb:53:in `generate''
from c:/Ruby/lib/ruby/1.8/soap/processor.rb:30:in `marshal''
from c:/Ruby/lib/ruby/1.8/soap/rpc/proxy.rb:169:in `marshal''
from c:/Ruby/lib/ruby/1.8/soap/rpc/proxy.rb:103:in `invoke''
from c:/Ruby/lib/ruby/1.8/soap/rpc/proxy.rb:131:in `call''
from c:/Ruby/lib/ruby/1.8/soap/rpc/driver.rb:275:in `call''
from c:/Ruby/lib/ruby/1.8/soap/rpc/driver.rb:302:in
`test_time''
from c:/Ruby/lib/ruby/1.8/soap/rpc/driver.rb:297:in
`test_time''
from
c:/Ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.6.2/lib/action_we
b_service/client/soap_client.rb:61:in `send''
from
c:/Ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.6.2/lib/action_we
b_service/client/soap_client.rb:61:in `perform_invocation''
from
c:/Ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.6.2/lib/action_we
b_service/client/base.rb:15:in `method_missing''
from (irb):3irb(main):004:0>
Is this a known issue? And is there a way to workaround this problem?
With kind regards,
Peter