I agree strongly with Tarh331_Dad's approach, but I would modify it to say that you don't really need to write down the notes on a paper as it can be tedious. Just record yourself singing or humming a solo. Then, try to play it on the trumpet, and also see how what you're playing relates to the chord changes. You will probably find that what you naturally want to sing/play is some mixture of notes and rhythms which outlines the changes but which is not restricted to just the notes in the chord. Once you get a feel for how the ideas in your mind lines up with the changes, the chord changes will start to help you find the notes that you want to play. When your ear becomes fast enough, you may even opt to ignore the changes altogether. Also, beware of chord changes that are poorly written, which can be a problem with some sheets online. Don't be afraid to modify them. This may take some time but will strengthen your ear.