A study of solitary waves by He's semi-inverse variational principle