0

I do not understand the people who prefer Savon to Soap4r.

How can I get the attributes of the returned object in a Savon response? With soap4r it's as clean as invoking a getter!

Apparently, in Savon I need to explicitly parse the response and walk the response_hash. This is way worse than the soap4r approach. Am I getting something wrong, or is Savon just a worse-quality soap4r?

edit: this question was due to savon not properly supporting multi_ref responses, as stated in an answer comment.

4

1 に答える 1

1

https://github.com/raldred/savon/blob/master/lib/savon/response.rbから

  # You can also let Savon translate the SOAP response body to a Hash.
  #
  #   response.to_hash
  #   => { :findUserByIdResponse => {
  #   =>   :id => "123",
  #   =>   :username => "eve"
  #   =>   :active => true
  #   => }

したがって、属性を返す hash[:object] を呼び出すことができるはずです。

to_hash を呼び出すだけで、応答オブジェクトを処理する必要はありません。

于 2011-06-02T20:55:46.527 に答える