Call a web service
def lookup_upc(upc) server = XMLRPC::Client.new2('http://www.upcdatabase.com/rpc') begin response = server.call('lookupUPC', upc) return response['found'] ? response : nil rescue XMLRPC::FaultException => e puts "Error: " puts e.faultCode puts e.faultString end end product = lookup_upc('018787765654') product['description'] product['size'] lookup_upc('no such UPC')