As a de facto standard, OWL-S enables the semantic description of Web services, resulting in the automated discovery, selection, and composition of Web services. However, the complexity of the OWL-S grammar makes it difficult to construct an OWL-S ontology manually. This paper presents an efficient method for generating OWL-S ontologies from UML diagrams, which are widely used for software design and development. The proposed method uses a class diagram to represent a domain ontology and sequence or activity diagrams to represent the behavior of a business process. It also uses UML profiles to support various features of OWL-S. Finally, an XMI file extracted from UML diagrams is transformed into an OWL-S ontology via an XSLT script. Experimental results with a large volume of UML diagrams show that the proposed method deals with the control flow of complex processes and is superior to previous methods.