  We develop the theory of transformation of intensive initial nonlinear wave
pulses to trains of solitons emerging at asymptotically large time of
evolution. Our approach is based on the theory of dispersive shock waves in
which the number of nonlinear oscillations in the shock becomes the number of
solitons at the asymptotic state. We show that this number of oscillations,
which is proportional to the classical action of particles associated with the
small-amplitude edges of shocks, is preserved by the dispersionless flow. Then
the Poincar\'e-Cartan integral invariant is also constant and therefore it
reduces to the quantization rule similar to the Bohr-Sommerfeld quantization
rule for linear spectral problem associated with completely integrable
equations. This rule yields a set of `eigenvalues' which are related with the
asymptotic solitons' velocities and other their characteristics. Our analytical
results agree very well with the results of numerical solutions of the
generalized nonlinear Schr\"odinger equation.
