How to get my dog to stop messing in his crate?

I have a 7 month old male boxer. House trained but he poops and urinates in his crate. He does sleep in my bed but doesn't hesitate to go into his crate. I put his food bowl in his crate with the door open and he goes in and out of the crate to eat with no hesitation. Any suggestions??