In service-oriented grid market, a lot of deception and unreliable services exist due to the inherent selfishness of nodes. It may lead to the total collapse of the system. Aiming to regulate the behavior of selfish nodes, a reputation-based market model is proposed in this paper. We take the viewpoint that service level can be traded for price. Service consumers buy service according to the system's recommendation derived from reputation mechanism. Service providers are modeled as learning agents, using Q-learning algorithm to learn from the environment. Eventually, each provider arrives at an optimal dynamic service level policy that optimizes its benefit in the long run. Simulation results show that the proposed model can simultaneously guarantee the interests of both the providers and consumers, and the behavior of selfish nodes converges to their optimal strategies.