I don't know a single author out there that hasn't been rejected at least once. It's heartbreaking, how could they do this to you? It takes a toll, believe me. But it is definitely not the end of the line.
So how do you pick yourself up and dust yourself off after such a blow?
1. It is not a personal attack.
They have seen your words and your story, but they do not know you. It is not an attack on your person or your psyche.
2. If they gave reasons, take them to heart as constructive criticism.
Most good publishers will give solid reasons as to why they did not accept your work. Either it didn't fit, or needed shortening/lengthening, there were story continuity issues, whatever. Keep in mind they have a business to run and will take what they think will sell.
3. Keep at it.
This is not the end of the line, not by a long shot. My first couple of books were rejected but they gave reasons and I worked on them. Dive into your contacts for a good beta (which are worth their weight in gold). With help, polish up the story and re-submit it somewhere else.
4. If you're the Indie type, do it yourself.
If you've got drive, motivation, and a good network, go indie! I've done this with a couple of mine and have gotten a great response. I found that I didn't need a publishing house to accept me to give my story 'worth'. I knew it was good and didn't want to wait. (very impatient person). It paid off for the most part.
5. Keep writing.
No matter what, this is your craft, don't let them rule what you want to do. I've been writing since I was seven years old and minus a couple of years off sporadically; it has been my lifelong pursuit. If you feel it, write it. Go with your passion. The audience will find you.
S. L. Danielson, Author