"The Water of Life" is a German fairy tale collected by the Brothers Grimm, tale number 97.
A king was dying. An old man told his sons that the water of life would save him. Each one set out in turn. The two older ones, setting out in hopes of being the heir, were rude to a dwarf on the way and became trapped in ravines. When the youngest son went the dwarf asked where he was going, and he told him. The dwarf told him it was in a castle, and gave him an iron wand to open the gates and two loaves to feed to the lions inside. Then he had to get the water before the clock struck 12 when the gates would shut again...