Berger, Daniel
2006-May-19 20:17 UTC
[Rails] Strange error when testing layered web service
Hi all,
Ruby 1.8.4
Rails 1.1.2
1) Error:
test_find_hardware_by_id(HardwareControllerApiTest):
ArgumentError: illegal refid http://test.host/
c:/ruby/lib/ruby/1.8/soap/baseData.rb:166:in `decode''
c:/ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:153:in
`decode_tag''
c:/ruby/lib/ruby/1.8/soap/parser.rb:179:in `decode_tag''
c:/ruby/lib/ruby/1.8/soap/parser.rb:130:in `start_element''
c:/ruby/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in `start_element''
c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:34:in `do_parse''
c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `do_parse''
c:/ruby/lib/ruby/1.8/soap/parser.rb:92:in `parse''
c:/ruby/lib/ruby/1.8/soap/processor.rb:39:in `unmarshal''
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/protocol/soap_proto
col.rb:84:in `decode_response''
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/test_invoke.rb:60:i
n `decode_rpc_response''
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/test_invoke.rb:26:i
n `invoke_layered''
hardware_api_test.rb:21:in `test_find_hardware_by_id''
1 tests, 0 assertions, 0 failures, 1 errors
I''m not sure why it''s looking at http://test.host when it
ought to be
looking at http://localhost/webservice/api (on port 3000).
What am I doing wrong? Am I supposed to be setting that somewhere?
Here''s my simple test:
require File.dirname(__FILE__) + ''/../test_helper''
require ''webservice_controller''
class WebserviceController
def rescue_action(e)
raise e
end
end
class HardwareControllerApiTest < Test::Unit::TestCase
fixtures :stuff
def setup
@controller = WebserviceController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@uid = ''xxx''
end
def test_find_hardware_by_id
result = invoke_layered(''hardware'',
:find_hardware_by_id, 1, @uid)
assert(result[0].is_a?(Integer))
end
end
Thanks,
Dan
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
Berger, Daniel
2006-May-24 17:55 UTC
[Rails] Strange error when testing layered web service
> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of > Berger, Daniel > Sent: Friday, May 19, 2006 2:17 PM > To: rails@lists.rubyonrails.org > Subject: [Rails] Strange error when testing layered web service > > > Hi all, > > Ruby 1.8.4 > Rails 1.1.2 > > 1) Error: > test_find_hardware_by_id(HardwareControllerApiTest): > ArgumentError: illegal refid http://test.host/ > c:/ruby/lib/ruby/1.8/soap/baseData.rb:166:in `decode'' > c:/ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:153:in > `decode_tag'' > c:/ruby/lib/ruby/1.8/soap/parser.rb:179:in `decode_tag'' > c:/ruby/lib/ruby/1.8/soap/parser.rb:130:in `start_element'' > c:/ruby/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in `start_element'' > c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:34:in `do_parse'' > c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `do_parse'' > c:/ruby/lib/ruby/1.8/soap/parser.rb:92:in `parse'' > c:/ruby/lib/ruby/1.8/soap/processor.rb:39:in `unmarshal'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/acti > on_web_ser > vice/protocol/soap_proto > col.rb:84:in `decode_response'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/acti > on_web_ser > vice/test_invoke.rb:60:i > n `decode_rpc_response'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/acti > on_web_ser > vice/test_invoke.rb:26:i > n `invoke_layered'' > hardware_api_test.rb:21:in `test_find_hardware_by_id'' > > 1 tests, 0 assertions, 0 failures, 1 errors<snip> For anyone following and future Googlers, this was caused by a redirect (in ApplicationController) that I didn''t realize was happening. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.