# ActionWebServer and SOAPFault

**URL:** <https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115229>\
**Category:** Rails\
**Created:** [September 22, 2007, 1:30am UTC](https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115229 "2007-09-22T01:30:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![locky2003](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d2c977/32.png) [@locky2003](https://www.ruby-forum.com/u/locky2003)\
**Post date:** [September 22, 2007, 1:30am UTC](https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115229/1 "2007-09-22T01:30:02Z")

</div>

I’m really new to RoR and my first task is to write SOAP web service.  
The problem is that I don’t understand how to send custom SOAPFault  
messages in case of the errors.

For example, I have FindCustomerById API signature:

api\_method :find\_customer\_by\_id,  
:expects =\> [{:customer\_id =\> :int}],  
:returns =\> [Customer]

And controller:

def find\_customer\_by\_id(customer\_id)  
Customer.find(customer\_id)  
end

The requirement from the vendor is that if such customer does not exist  
I have to send back to client SOAPFault message with faultcode =  
“error”, faultstring = “no such customer” and such detail:

incorrect\_request Custome with such customer\_id does not exists

I’m cant figure out how to construct such SOAPFault message and send it  
back. Please help me, with some example code if possible.
