diff --git a/lib/wasabi/parser.rb b/lib/wasabi/parser.rb index f121d98..c6f1b69 100644 --- a/lib/wasabi/parser.rb +++ b/lib/wasabi/parser.rb @@ -144,7 +144,7 @@ def parse_operations # TODO: check for soap namespace? soap_operation = operation.element_children.find { |node| node.name == 'operation' } soap_action = soap_operation['soapAction'] if soap_operation - soap_document = soap_operation["style"] if soap_operation + soap_document = soap_operation['style'] == 'document' if soap_operation if soap_action || soap_document soap_action = soap_action.to_s @@ -260,8 +260,13 @@ def input_output_for(operation, input_output) end message_ns_id, message_type = nil - message_ns_id = port_message_ns_id - message_type = port_message_type + + soap_operation = operation.element_children.find { |node| node.name == 'operation' } + + if soap_operation.nil? || soap_operation['style'] != 'rpc' + message_ns_id = port_message_ns_id + message_type = port_message_type + end # When there is a parts attribute in soap:body element, we should use that value # to look up the message part from messages array. diff --git a/spec/fixtures/rpc_operation.wsdl b/spec/fixtures/rpc_operation.wsdl new file mode 100644 index 0000000..46383f8 --- /dev/null +++ b/spec/fixtures/rpc_operation.wsdl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec/wasabi/document/rpc_spec.rb b/spec/wasabi/document/rpc_spec.rb new file mode 100644 index 0000000..a811cc6 --- /dev/null +++ b/spec/wasabi/document/rpc_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe Wasabi::Document do + context "with: rpc_operation.wsdl" do + subject { Wasabi::Document.new(fixture(:rpc_operation).read) } + + describe "#operations" do + subject { super().operations } + + it do + should include( + { + example_operation: { + action: "urn:ExampleInterface-ExamplePortType#ExampleOperation", + input: "ExampleOperation", + output: "ExampleOperation", + namespace_identifier: "tns" + } + } + ) + end + end + end +end