The SPWebService class is primarily a container for SPWebApplication objects. Use the WebService property of the SPWebApplication class to return the parent Web service of a Web application, and use the WebService property of the SPWebApplicationBuilder class to set the Web service for a new Web application. To return a reference to the current Web service, you can use SPWebService.ContentService.
To return the collection of Web services that are installed within the farm, use the SPWebServiceCollection constructor.
Use an indexer to return a single Web service from the collection. For example, if the collection is assigned to a variable named myWebServices, use myWebServices[index] in C#, or myWebServices(index) in Visual Basic, where index is either the name or the GUID that identifies the Web service.