With the rapid growth and wide adoption of web services, service discovery is becoming commonly used to locate the optimal services that can meet the requirements of users. This paper proposes a bidirectional long short-term memory (Bi-LSTM) service discovery method that integrates contextual representation and attention mechanisms for web service discovery. To conduct the study, FastText word embedding with the N-gram feature is primarily used as the input of the Bi-LSTM model to obtain the context feature vector of the service function description. Moreover, the attention mechanism is employed to calculate the similarity of the service function description to gain the semantic feature vector of the correlation degree between services. Then, the multilayer perceptron network is used to mine the mapping relationship between semantic feature vectors and matching levels among services. Finally, for a given query, target services are retrieved by ranking candidate services according to the prediction cores through the matching method. The proposed method is examined against multiple evaluation metrics, including accuracy and error, and compared with the state-of-the-art searching approaches. The experimental results show that the proposed method is more effective and attains better relevant web services, which helps the request service find more accurate results. Furthermore, this study provides new insights for researchers into web service discovery.