adding and removing webservice is not recommended and i dont think its possible! You have the files in the isapi folder as DrFeelgood noted! in the isapi contains the wsdl and disco files.
But.... a big but.. you also need the webservice in the GAC folder (assembly). That means if you want to change the webservice to contain methods/remove than you would need to ammend the dll.
that moves me to the project, in your project when you reference to the webservice you would need to update it every time you add/remove.
So short answer is no, well not that i know of ;)
as stated by DrFeelgood, you need to add your dll to gac, add disco and wsdl to ISAPI folder for discovery (_VTI_Bin) add web reference to your project and use the method that you require accordingly when activating/deactivating!
is there any reason why you want to do it that way?
Ok that makes sense!
in your method within the webservice you need to check for the feature and if its active or deactive, if active (true) carry on and return the result else return false if feature is deactive!
this is to check if the feature is active!
public static myCustomWebservicemethod()
string guidStringFeature = "545646-56454-54665-56464";
Guid guid = new Guid( guidStringFeature);
using(SPSite site = new SPSite("url"))
if(IsFeatureActivated(site ,guid) == true)
//carry on with the webservice and return the value
//if its deactive than return false (nothing ;))
public static bool IsFeatureActivated(this SPSite site, Guid featureId)
return site.WebApplication.WebService.Fteaures[featureID] != null;
this method is better and less hassle / a method that i would recommend!