savonrb/savon — pull request #533 by timabdulla (2013-12-13 00:52:33+00:00)
Title: use message_tag rather than operation_name in Message

I've just gotten around to upgrading from savon 1 to savon 2 (I know, I know), and I've noticed an interesting regression to do with the assigning of namespaces to elements in a message.

in both savon 1 and savon 2, there is a method (in the case of savon 2, `Savon::QualifiedMessage#to_hash`) that recursively converts unqualified keys in the message hash to keys qualified by namespace. the method has an argument called `path` that lets the method know where to look for namespace information. when the method makes a recursive call, it updates the path argument with the method's current position in the type hierarchy.

obviously, the first call to `#to_hash` requires a seed value for the `path` argument. in the case of savon 2, this is the operation name after being transformed by the key converter. in the case of savon 1, this is actually the input tag of the operation.

this is a regression because in some cases the input tag will be different than the operation name after being transformed by the key converter. if it is different, then namespaces will not be properly applied to the keys of the message hash, as the initial path seed value will be wrong.

this PR uses `Savon::Builder#message_tag` instead of `operation_name` to seed the type path in `QualifiedMessage#to_hash`. `#message_tag` attempts to fetch the input tag of the operation in the WSDL if possible, but it falls back to simply converting the operation name using the key converter otherwise. thus, this change should not have any adverse effects.