This paper presents a new solar-powered fixed-wing unmanned aerial vehicle (UAV)-assisted data collection technique, where a fixed-wing UAV harvests solar energy to fly and collect data from smart devices (SDs). The minimum of the data upload-ed from any of the SDs is maximized by optimizing the UAV's three-dimensional (3D) trajectory. The key idea is that we develop variable substitution and successive convex approximation (SCA) techniques to convexify the nonconvex data transmission, UAV energy consumption and mobility constraints, as well as the nonconvex energy harvesting constraint. The proposed algorithm guarantees a locally optimal solution satisfying the Karush-Kuhn-Tucker (KKT) conditions. Another important aspect is that an effective set of approximation parameters are identified for accurate approximation of the solar energy harvesting at relatively low altitudes, contributing to the design of efficient 3D trajectories balancing energy harvesting and data collection. Numerical results show that the 3D flight increases uploaded data by 59% as compared to the two-dimensional (2D) flight.