From: Chris McMahon Date: 2006-08-03T08:15:09+09:00 Subject: Re: How to capture a SOAP exception from a webservice? begin @query = @soap.apiFunction( {'Key'=>'Value','Key2'=>Value2'} ) #rescue ::SOAP::FaultError => e rescue ::XSD::ValueSpaceError => e assert_equal("{http://www.foo.com/api}FooBarEnum: cannot accept 'foo'",e.to_s) end Hope that helps... -Chris Nate Imaqaguy wrote: > I'm trying to catch a soap exception from a web service, but I'm a n00b > and am having a hard time figuring it out. > > I'm using ruby 1.8.4 (win32)--if it matters. > > I've got the start of my program created and can receive successful soap > objects back from the webservice. So that's all working good. > > Next, I want to capture SOAP exception errors. For example, I'll get a > message saying something does not exist or is not found. This is the > same message that is in the return XML "faultstring" tag. > > Do I have to find a way to parse the returned XML, or is there an easy > way to grab the soap exception I'm looking for? > > Thanks for the help. BTW, I tried to use the forum search (I always try > that first), but it's down for maintenance or something like that. > > Thanks all, > > -nate > > -- > Posted via http://www.ruby-forum.com/.