Planetesimal dissolution in the envelopes of the forming, giant planets