diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-06-13 02:58:44 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-06-13 02:58:44 +0000 |
commit | 887e67c80e12308467526d731e74fafef9f07ac9 (patch) | |
tree | a306e4e94e7224ff2d6e8c4e028c3ed5f6c50855 | |
parent | 1fde44bfee41a35469084e1c73e2bccbd4e5fbe8 (diff) | |
download | rails-887e67c80e12308467526d731e74fafef9f07ac9.tar.gz rails-887e67c80e12308467526d731e74fafef9f07ac9.tar.bz2 rails-887e67c80e12308467526d731e74fafef9f07ac9.zip |
Fix moduled controller URLs in WSDL, and add unit test to verify the generated URL.
See ticket #1428.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1408 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
3 files changed, 13 insertions, 5 deletions
diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG index fd3621f023..c1fffb523a 100644 --- a/actionwebservice/CHANGELOG +++ b/actionwebservice/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fix moduled controller URLs in WSDL, and add unit test to verify the generated URL #1428 + * Fix scaffolding template paths, it was broken on Win32 * Fix that functional testing of :layered controllers failed when using the SOAP protocol diff --git a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb index 13a6fa55d3..21e3ccedbf 100644 --- a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +++ b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb @@ -167,7 +167,7 @@ module ActionWebService # :nodoc: host = request.env['HTTP_HOST'] || request.env['SERVER_NAME'] || 'localhost' relative_url_root = request.relative_url_root scheme = request.ssl? ? 'https' : 'http' - '%s://%s%s/%s/' % [scheme, host, relative_url_root, controller_name] + '%s://%s%s/%s/' % [scheme, host, relative_url_root, self.class.controller_path] end def to_wsdl diff --git a/actionwebservice/test/dispatcher_action_controller_soap_test.rb b/actionwebservice/test/dispatcher_action_controller_soap_test.rb index 4451c23f3c..aa57765b2c 100644 --- a/actionwebservice/test/dispatcher_action_controller_soap_test.rb +++ b/actionwebservice/test/dispatcher_action_controller_soap_test.rb @@ -92,10 +92,10 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase def ensure_valid_wsdl_generation(controller) wsdl = controller.generate_wsdl - ensure_valid_wsdl(wsdl) + ensure_valid_wsdl(controller, wsdl) end - def ensure_valid_wsdl(wsdl) + def ensure_valid_wsdl(controller, wsdl) definitions = WSDL::Parser.new.parse(wsdl) assert(definitions.is_a?(WSDL::Definitions)) definitions.bindings.each do |binding| @@ -110,15 +110,21 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase types.each do |type| assert(type.namespace == 'urn:ActionWebService') end + location = definitions.services[0].ports[0].soap_address.location + if controller.is_a?(DelegatedController) + assert_match %r{http://localhost/dispatcher_test/delegated/test_service$}, location + elsif controller.is_a?(DirectController) + assert_match %r{http://localhost/dispatcher_test/direct/api$}, location + end definitions.collect_complextypes end def ensure_valid_wsdl_action(controller) test_request = ActionController::TestRequest.new({ 'action' => 'wsdl' }) test_request.env['REQUEST_METHOD'] = 'GET' - test_request.env['HTTP_HOST'] = 'localhost:3000' + test_request.env['HTTP_HOST'] = 'localhost' test_response = ActionController::TestResponse.new wsdl = controller.process(test_request, test_response).body - ensure_valid_wsdl(wsdl) + ensure_valid_wsdl(controller, wsdl) end end |