Hi everyone I am using a SOAP web service to get some information. The SOAP4R library is supposed to create methods for the elements in a SOAP response. When I do my SOAP call these methods are not created. The informations shows up when I do soap_response.inspect but I cannot access it directly. Is there any way to get access to the raw XML response so I can parse it myself? Kindest regards and thanks in advance Erik Lindblad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erik, You can use REXML to parse the response directly, which I find easier than messing with the generated methods. You have to learn a little Xpath, but it''s pretty easy to pick up. I use code like this: require ''rexml/document'' require ''rexml/formatters/pretty'' response = REXML::Document.new(soap_result) element = xml.elements[''//result''] # can use any Xpath query here if element.attributes[''code''] == "100" # etc else # etc end -Mike Subelsky Hacker & Improvisor // subelsky.com On Mar 18, 2:05 am, Erik Lindblad <e...-gTO0lQh45js@public.gmane.org> wrote:> Hi everyone > > I am using a SOAP web service to get some information. The SOAP4R > library is supposed to create methods for the elements in a SOAP > response. When I do my SOAP call these methods are not created. The > informations shows up when I do soap_response.inspect but I cannot > access it directly. Is there any way to get access to the raw XML > response so I can parse it myself? > > Kindest regards and thanks in advance > > Erik Lindblad--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Great advice Mike. I will definitely use it. The problem (which feels quite silly) is that I cannot get the raw SOAP response from the SOAP::Mapping::Object instance that is the result of the SOAP call. I would like to do xml_tree =REXML::Document.new(soap_result.raw_xml) But what is the raw_xml method? Many thanks in advance Erik On 18 Mar, 15:41, Mike Subelsky <m...-QWJikKWrmpdWk0Htik3J/w@public.gmane.org> wrote:> Erik, > > You can use REXML to parse the response directly, which I find easier > than messing with the generated methods. You have to learn a little > Xpath, but it''s pretty easy to pick up. I use code like this: > > require ''rexml/document'' > require ''rexml/formatters/pretty'' > > response = REXML::Document.new(soap_result) > > element = xml.elements[''//result''] # can use any Xpath query here > if element.attributes[''code''] == "100" > # etc > else > # etc > end > > -Mike Subelsky > Hacker & Improvisor // subelsky.com > > On Mar 18, 2:05 am, Erik Lindblad <e...-gTO0lQh45js@public.gmane.org> wrote: > > > Hi everyone > > > I am using a SOAP web service to get some information. The SOAP4R > > library is supposed to create methods for the elements in a SOAP > > response. When I do my SOAP call these methods are not created. The > > informations shows up when I do soap_response.inspect but I cannot > > access it directly. Is there any way to get access to the raw XML > > response so I can parse it myself? > > > Kindest regards and thanks in advance > > > Erik Lindblad--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erik Lindblad wrote:> Great advice Mike. I will definitely use it. The problem (which feels > quite silly) is that I cannot get the raw SOAP response from the > SOAP::Mapping::Object instance that is the result of the SOAP call. I > would like to do xml_tree =REXML::Document.new(soap_result.raw_xml) > But what is the raw_xml method? > > Many thanks in advance > > ErikHi Erik, Were you able to resolve this issue? I am also having the same issue... please help...I don''t know how to parse my SOAP::Mapping::Object Googled a lot....but no use.. Thanks Anu -- Posted via http://www.ruby-forum.com/.
hi all, can you help me how i can use soap response as xml file in Rexml. for example: response = obj.createUser(createUsers) response is my final result which i am getting by running script. so if i use xml_tree =REXML::Document.new(response.raw_xml) that time it gives me error. so anyone can tell me how can i convert this file to xml and use for rexml. i want to use rexml for parsing attribute from response file. Thanks Rpatel -- Posted via http://www.ruby-forum.com/.
hi all, can you help me how i can use soap response as xml file in Rexml. for example: response = obj.createUser(createUsers) response is my final result which i am getting by running script. so if i use xml_tree =REXML::Document.new(response.raw_xml) that time it gives me error. so anyone can tell me how can i convert this file to xml and use for rexml. i want to use rexml for parsing attribute from response file. Thanks Rpatel -- Posted via http://www.ruby-forum.com/.
To get raw XML from SOAP4R set wiredump_file_base attribute of SOAP::RPC::Driver instance to some string value. It will be used as a prefix for files to save raw XML request and response in the current dir. Or, alternatively, do ''driver.wiredump_dev = STDOUT'' and SOAP4R will push raw XML to the console. Dm.L. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.