# AWS, SOAP, and Exceptions

**URL:** <https://www.ruby-forum.com/t/aws-soap-and-exceptions/51817>\
**Category:** Rails\
**Created:** [January 7, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/aws-soap-and-exceptions/51817 "2006-01-07T16:17:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![james](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@james](https://www.ruby-forum.com/u/james)\
**Post date:** [January 7, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/aws-soap-and-exceptions/51817/1 "2006-01-07T16:17:57Z")

</div>

Can someone shed some light on how to convert an Exception to a  
SOAPFault on Rails 1.0/AWS 1.0? I’ve been digging through the source  
code and see that in soap\_protocol.rb there is a method called  
encode\_response() that seems to perform the translation of an Exception  
to a SOAPFault. However, if I use the following code block within my Web  
Service controller:

def get\_calendar(calId)  
begin  
return Calendar.find(calId)  
rescue Exception =\> e  
return e  
end  
end

I see the following error, prior to the call to encode\_reponse():

```
 "Don't know how to cast ActiveRecord::RecordNotFound to Calendar"

 c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action_web_service/casting.rb:119:in 

```

`cast_to_structured_type' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action_web_service/casting.rb:55:in`cast’  
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action\_web\_service/casting.rb:38:in  
`cast_returns' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action_web_service/casting.rb:25:in`cast\_returns’  
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action\_web\_service/api.rb:189:in  
`cast_returns' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action_web_service/dispatcher/abstract.rb:182:in`web\_service\_create\_response’  
c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-1.0.0/lib/action\_web\_service/dispatcher/abstract.rb:59:in  
`web\_service\_invoke’

Is this not supported yet, or am I missing something?

---

<div class="post-metadata">

**Author:** ![james](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@james](https://www.ruby-forum.com/u/james)\
**Post date:** [January 10, 2006, 2:14am UTC](https://www.ruby-forum.com/t/aws-soap-and-exceptions/51817/2 "2006-01-10T02:14:22Z")

</div>

James wrote:

> Can someone shed some light on how to convert an Exception to a  
> SOAPFault on Rails 1.0/AWS 1.0? I’ve been digging through the source…

Reposting. Can anyone confirm that Faults aren’t supported by RoR in  
v1.0, or if I should be taking a different approach to the problem?
