Psalm 40 is a Messianic Prophecy describing Jesus as He was about to step through the Door from Heaven to earth (Hebr 10:4-10). When He dedicated Himself to God as His bondservant to do His will, God opened His ears to hear & anointed Him to do His will. We see how this applies to us (Ro 12:1-8).