From d07922716a258e598a8dba34ed184772660cfffc Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Mon, 9 Dec 2013 00:05:29 -0800 Subject: [PATCH] Basically revert pull request #15 @paracycle was kind enough to track down these changes. I believe these changes may be valid for Output, but almost certainly not for Input. I had an opportunity to speak with @rubiii earlier about this and his thoughts were that it wasn't very surprising that this change broke a lot of real code. For one, it also changed specs. Secondly, there wasn't a real example of why this would need to be like this in the PR. Lastly, the end result of the code is overly complicated. I've just spent the last hour looking at the `input_output_for` method in Wasabi::Parser just to find out that this was pulling in a completely bogus request / response tag name in two thirds of the cases. My hopes are that this fix will fix the regression in Savon 2.3.x and we can stop worrying about this for Savon v3. --- lib/wasabi/parser.rb | 4 ++-- spec/wasabi/document/authentication_spec.rb | 2 +- spec/wasabi/document/multiple_namespaces_spec.rb | 2 +- spec/wasabi/document/namespaced_actions_spec.rb | 6 +++--- spec/wasabi/document/no_namespace_spec.rb | 6 +++--- spec/wasabi/document/savon295_spec.rb | 2 +- spec/wasabi/parser/no_message_parts_spec.rb | 14 +++++++------- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/wasabi/parser.rb b/lib/wasabi/parser.rb index ce7a832..796ed0c 100644 --- a/lib/wasabi/parser.rb +++ b/lib/wasabi/parser.rb @@ -269,9 +269,9 @@ def input_output_for(operation, input_output) # Fall back to the name of the binding operation if message_type - [message_ns_id, message_type] + [message_ns_id, operation_name] else - [port_message_ns_id, port_message_type] + [port_message_ns_id, operation_name] end else [nil, operation_name] diff --git a/spec/wasabi/document/authentication_spec.rb b/spec/wasabi/document/authentication_spec.rb index 265ba79..6f9447e 100644 --- a/spec/wasabi/document/authentication_spec.rb +++ b/spec/wasabi/document/authentication_spec.rb @@ -15,7 +15,7 @@ its(:operations) do should == { - :authenticate => { :input => "authenticate", :output => "authenticateResponse", :action => "authenticate", :namespace_identifier => "tns" } + :authenticate => { :input => "authenticate", :output => "authenticate", :action => "authenticate", :namespace_identifier => "tns" } } end diff --git a/spec/wasabi/document/multiple_namespaces_spec.rb b/spec/wasabi/document/multiple_namespaces_spec.rb index 0209bfa..7117530 100644 --- a/spec/wasabi/document/multiple_namespaces_spec.rb +++ b/spec/wasabi/document/multiple_namespaces_spec.rb @@ -14,7 +14,7 @@ it { should have(1).operations } its(:operations) do - should == { :save => { :input => "Save", :output=>"SaveResponse", :action => "http://example.com/actions.Save", :namespace_identifier => "actions", :parameters => { :article => { :name => "article", :type => "Article" } } } } + should == { :save => { :input => "Save", :output=>"Save", :action => "http://example.com/actions.Save", :namespace_identifier => "actions", :parameters => { :article => { :name => "article", :type => "Article" } } } } end its(:type_namespaces) do diff --git a/spec/wasabi/document/namespaced_actions_spec.rb b/spec/wasabi/document/namespaced_actions_spec.rb index daf83c6..daa33f4 100644 --- a/spec/wasabi/document/namespaced_actions_spec.rb +++ b/spec/wasabi/document/namespaced_actions_spec.rb @@ -15,9 +15,9 @@ its(:operations) do should include( - { :delete_client => { :input => "Client.Delete", :output => "Client.DeleteResponse", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } }, - { :get_clients => { :input => "User.GetClients", :output => "User.GetClientsResponse", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } }, - { :get_api_key => { :input => "User.GetApiKey", :output => "User.GetApiKeyResponse", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } } + { :delete_client => { :input => "DeleteClient", :output => "DeleteClient", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } }, + { :get_clients => { :input => "GetClients", :output => "GetClients", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } }, + { :get_api_key => { :input => "GetApiKey", :output => "GetApiKey", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } } ) end diff --git a/spec/wasabi/document/no_namespace_spec.rb b/spec/wasabi/document/no_namespace_spec.rb index 70750ce..30474ed 100644 --- a/spec/wasabi/document/no_namespace_spec.rb +++ b/spec/wasabi/document/no_namespace_spec.rb @@ -15,9 +15,9 @@ its(:operations) do should include( - { :get_user_login_by_id => { :input => "GetUserLoginById", :output => "GetUserLoginByIdResponse", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } }, - { :get_all_contacts => { :input => "GetAllContacts", :output =>"GetAllContactsResponse", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } }, - { :search_user => { :input => "SearchUser", :output =>"SearchUserResponse", :action => "/api/api/SearchUser", :namespace_identifier => nil } } + { :get_user_login_by_id => { :input => "GetUserLoginById", :output => "GetUserLoginById", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } }, + { :get_all_contacts => { :input => "GetAllContacts", :output =>"GetAllContacts", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } }, + { :search_user => { :input => "SearchUser", :output =>"SearchUser", :action => "/api/api/SearchUser", :namespace_identifier => nil } } ) end diff --git a/spec/wasabi/document/savon295_spec.rb b/spec/wasabi/document/savon295_spec.rb index cd97e11..c8b8375 100644 --- a/spec/wasabi/document/savon295_spec.rb +++ b/spec/wasabi/document/savon295_spec.rb @@ -7,7 +7,7 @@ its(:operations) do should include( - { :sendsms => { :input => "sendsmsRequest", :output => "sendsmsResponse", :action => "sendsms", :namespace_identifier => "tns" } } + { :sendsms => { :input => "sendsms", :output => "sendsms", :action => "sendsms", :namespace_identifier => "tns" } } ) end diff --git a/spec/wasabi/parser/no_message_parts_spec.rb b/spec/wasabi/parser/no_message_parts_spec.rb index 313cd5e..1985aba 100644 --- a/spec/wasabi/parser/no_message_parts_spec.rb +++ b/spec/wasabi/parser/no_message_parts_spec.rb @@ -1,7 +1,7 @@ -require "spec_helper" +require 'spec_helper' describe Wasabi::Parser do - context "with: no_message_parts.wsdl" do + context 'with: no_message_parts.wsdl' do subject do parser = Wasabi::Parser.new Nokogiri::XML(xml) @@ -11,16 +11,16 @@ let(:xml) { fixture(:no_message_parts).read } - it "falls back to using the message type in the port element" do + it 'falls back to using the message type in the port element' do # Operation's input has no part element in the message, so using the message type. - subject.operations[:save][:input].should == "SaveSoapIn" + subject.operations[:save][:input].should == 'Save' # Operation's output has part element in the message, so using part element's type. - subject.operations[:save][:output].should == "SaveResponse" + subject.operations[:save][:output].should == 'Save' end - it "falls back to using the namespace ID in the port element" do - subject.operations[:save][:namespace_identifier].should == "actions" + it 'falls back to using the namespace ID in the port element' do + subject.operations[:save][:namespace_identifier].should == 'actions' end end end