Skip to content
New issue

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

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

Already on GitHub? # to your account

Savon does not always handle :content! correctly #772

Closed
bmattei opened this issue Jul 7, 2016 · 2 comments
Closed

Savon does not always handle :content! correctly #772

bmattei opened this issue Jul 7, 2016 · 2 comments

Comments

@bmattei
Copy link

bmattei commented Jul 7, 2016

If Savon is initialized with element_form_default: :qualified (the default) it converts the hash key: :content! to "content!".

Gyoku understands :content! as a keyword indicating the value associated with the key is the content of the element. When it is converted to "content!" it loses it's meaning to Gyoku.

Changed
Savon.client(wsdl: @wsdl_path,
encoding: "UTF-8",
env_namespace: :soapenv, namespace_identifier: :ns,
namespaces: {"xmlns:ns" => "http://www.endeca.com/MDEX/conversation/services/types/3/0",
"xmlns:ns1" => "http://www.endeca.com/MDEX/conversation/XQuery/2009/09"},
raise_errors: false,
log_level: :debug
)

to
Savon.client(wsdl: @wsdl_path,
encoding: "UTF-8",
env_namespace: :soapenv, namespace_identifier: :ns,
namespaces: {"xmlns:ns" => "http://www.endeca.com/MDEX/conversation/services/types/3/0",
"xmlns:ns1" => "http://www.endeca.com/MDEX/conversation/XQuery/2009/09"},
raise_errors: false,
element_form_default: :unqualified,
log_level: :debug
)

To work around the problem.

Found the issue by setting a break point in
message.rb#to_s.

  • After calling QualifiedMessage.new(@types, @used_namespaces, @key_converter).to_hash(@message, [@message_tag.to_s])

any :content! key is converted to "content!"

@shkigor
Copy link

shkigor commented Jan 10, 2017

I've the same issue if I create new client and invoke call method.
Just for note, :content! option was worked on the Savon version '2.2.0'

client = Savon.client do
   wsdl ...
end
response = client.call(:create_token, message: {
        :user => userName,
        :param => {
            :@name => "shopId",
            :content! => shopId
        }
    })

When I use class which extend Savon::Model
:content! option is worked succesfully on the Savon version (2.11.1)!!!

class User
  extend Savon::Model

  client endpoint: ...
  def self.create_token(userName, shopId)
    super(message: {
        :user => userName,
        :param => {
            :@name => "shopId",
            :content! => shopId
        }
    })
  end
end

@pcai
Copy link
Member

pcai commented Aug 4, 2017

Thanks for reporting this. I believe this is fixed in #676 which is released in v2.11.2 - can you give this a try and reopen if you find an issue? Thanks!

@pcai pcai closed this as completed Aug 4, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

3 participants