Automatic Web service composition is gaining momentum as the potential silver bullet in service oriented architecture. The need for interservice compatibility analysis and indirect composition has gone beyond what the existing service composition/verification technologies can handle. Given two services whose interface invocation constraints are described by a Web services-business process execution language (WS-BPEL or BPEL), we analyze their compatibility and adopt mediation as a lightweight approach to make them compatible without changing their internal logic. We first transform a BPEL description into a service workflow net, which is a kind of colored Petri net (CPN). Based on this formalism, we analyze the compatibility of two services, and then devise an approach to check whether there exists any message mediator so that their composition does not violate the constraints imposed by either side. The method for mediator generation is finally proposed to assist the automatic composition of partially compatible services. Our approach is validated through a real-life case and further research directions are pointed out.