We did not take the taxi or train to Pompeii, but our table mates did take the train instead of a Princess tour and said they saved alot of money. I did not inquire as to how long the train ride was, but as I recall from our bus tour Pompeii is just south of Naples and it seems it was not more than 30-60 minutes by bus. They did say it was very easy to take the train.
Have you checked to see if there is a web site for Pompeii that might provide information on tours, and trains, etc. ?