It seems that the best approach, for the moment, was to just roll my own parsing using XPath. It's crude and probably not very bullet proof, but will do the job until something better comes along.
It seems that the best approach, for the moment, was to just roll my own parsing using XPath. It's crude and probably not very bullet proof, but will do the job until something better comes along. Class SavonResponseXMLParser def initialize(response_xml) @doc = REXML::Document.
New(response_xml) end def get_property(property) property_value = nil elements = REXML::XPath. Match(@doc, "//#{property}") if (elements. Length == 1) element = elements0 href = element.
Attributes'href' if (href) href =~ /^#id(\d+)/ multiref_elements = REXML::XPath. Match(@doc,"//multiRef@id='id#{$1}'") if (multiref_elements. Length == 1) multiref_element = multiref_elements0 property_value = multiref_element.
Text end else property_value = element. Text end end return property_value end end.
You'll have to resolve the references manually: id = response. To_hash:get_user_risk_profile_response:get_user_risk_profile_return:href references = response. To_hash:multi_ref result = references.
Select {|ref| ref:id == id. Sub('#', '') } I'd recommend putting the above in a helper method/module: module MultiRef def resolve_ref(id) references = to_hash:multi_ref references. Select {|ref| ref:id == id.
Sub('#', '') } end end Savon::Response. Send(:include, MultiRef) Then simply do: response. Resolve_ref("#id1") Recursively replacing href hash values with their appropriate referenced values is left as an exercise to the reader ;).
I tried something like that, but ran into a roadblock. One of my SOAP responses contains reference values up to #id10. The response.
To_hash method decodes the 10 multiRef elements into an Array. Unfortunately the order of the values in the Array are not necessarily sequential. For example, multiRef href=#id5" does not end up being the 5th item in the Array.It could be any item in the Array.
I think this is a bug in the to_hash method. – Dave Isaacs Feb 24 at 14:53 Also, I believe the the Savon developer is currently working on proper handling for multipart responses.In the meantime, I am parsing the response by using REXML::XPath to query the response. To_xml string.
This is working fine. – Dave Isaacs Feb 24 at 14:58 The above solution should work, as it looks up by actual ID, and not by array index. But yes, using XPath on the raw XML response makes a lot more sense.
– Jacob Feb 25 at 17:18 Oh, by the way, why not post your solution here? Answered questions are worth more than partial solutions, even if you are answering your own question. – Jacob Feb 25 at 17:20.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.