Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rpc encoded wsdl #744

Merged
merged 1 commit into from
Mar 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions lib/savon/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def build_document
if @globals[:no_message_tag]
tag(xml, :Body, body_attributes) { xml << message.to_s }
else
tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << body_message } }
end
end

Expand Down Expand Up @@ -141,6 +141,7 @@ def header

def namespaced_message_tag
tag_name = message_tag
return [tag_name] if @wsdl.document? and @wsdl.soap_input(@operation_name.to_sym).is_a?(Hash)
if namespace_identifier == nil
[tag_name, message_attributes]
elsif @used_namespaces[[tag_name.to_s]]
Expand All @@ -150,8 +151,25 @@ def namespaced_message_tag
end
end

def serialized_message_tag
[:wsdl, @wsdl.soap_input(@operation_name.to_sym).keys.first, {}]
end

def serialized_messages
messages = ""
message_tag = serialized_message_tag[1]
@wsdl.soap_input(@operation_name.to_sym)[message_tag].each_pair do |message, type|
break if @locals[:message].nil?
message_locals = @locals[:message][message.snakecase.to_sym]
message_content = Message.new(message_tag, namespace_identifier, @types, @used_namespaces, message_locals, :unqualified, @globals[:convert_request_keys_to], @globals[:unwrap]).to_s
messages << "<#{message} xsi:type=\"#{type.join(':')}\">#{message_content}</#{message}>"
end
messages
end

def message_tag
message_tag = @locals[:message_tag]
message_tag = @wsdl.soap_input(@operation_name.to_sym).keys.first if @wsdl.document? and @wsdl.soap_input(@operation_name.to_sym).is_a?(Hash)
message_tag ||= @locals[:message_tag]
message_tag ||= @wsdl.soap_input(@operation_name.to_sym) if @wsdl.document?
message_tag ||= Gyoku.xml_tag(@operation_name, :key_converter => @globals[:convert_request_keys_to])

Expand All @@ -162,6 +180,14 @@ def message_attributes
@locals[:attributes] || {}
end

def body_message
if @wsdl.document? and @wsdl.soap_input(@operation_name.to_sym).is_a?(Hash)
serialized_messages
else
message.to_s
end
end

def message
element_form_default = @globals[:element_form_default] || @wsdl.element_form_default
# TODO: clean this up! [dh, 2012-12-17]
Expand Down
Loading