How is making a cake for a gay wedding going against his beliefs? He's not marrying them, he's just making a cake. I don't necessarily agree with a judge forcing a business owner to do business in this manner, but if we didn't enforce these types of laws, we'd still have colored seating on buses and in restaurants.
Basically, the guy has no grounds for citing religious reasons. If he was smart, he would have just said he didn't want to do it or was too busy or something.