I have the same issue with iphone 3gs which I have had from new. It worked fine on wall charger or USB then suddenly, I think after last OS update, only charges from a computer! There is so much misinformation on this topic about doing hard or soft resets, buying new chargers cos they're faulty etc. BUT, as my wife has an iphone 4 and hers still works off both the same wall charger and computer, but mine donesn't it is clearly nothing to do with the charger! It must be a phone software problem.
I also have an iphone speaker dock that it used to happily charge off, and it won't do so rom that now either.
There is a fault/glitch that hasn't been actioned by Apple yet that must be causing this. It does make me aanxious to see no solutions, just massives of people reporting similar issues if you google the problem, and not a single person coming up with a solution that is working.
I would be very reluctant to upgrade my phone when it is due, with issues like this going unresolved! Come on Apple, don't let your customers down.