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