Model-independent analysis of soft terms in effective supergravity and in string theory