# ActionWebServer and SOAPFault

**URL:** <https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115274>\
**Category:** Rails\
**Created:** [September 23, 2007, 12:00am UTC](https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115274 "2007-09-23T00:00:16Z")\
**Posts on this page:** 2\
**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 23, 2007, 12:00am UTC](https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115274/1 "2007-09-23T00:00:16Z")

</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 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 cant figure out how to construct such SOAPFault message and send it  
back. Please help me, with some example code if possible.

---

<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:** [October 11, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/actionwebserver-and-soapfault/115274/2 "2007-10-11T16:56:50Z")

</div>

Hi,

I am actually having the same problem. Have you figured out how to  
construct a SOAPFault object using RoR? If so, would it possible to  
give me some clue?

Thanks,  
Yan
