문제

웹 서비스와 사용자 정의 로깅 서비스 클래스가 있습니다. 로깅 클래스에는 기능 이벤트 (Activated=SPService.Update, Deactivating=SPService.Delete)에 따라 자체를 업데이트하거나 제거하는 기능이 있습니다.

기능을 활성화 / 비활성화하는 기능으로 웹 서비스를 추가하거나 제거 할 수 있습니까?

도움이 되었습니까?

해결책

Adding and removing webservice is not recommended and i don’t 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?

EDIT

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
          return true;
     }
     }

     //if its deactive than return false (nothing ;))
     return false;
}

public static bool IsFeatureActivated(this SPSite site, Guid featureId)    
{         
    return site.WebApplication.WebService.Fteaures[featureID] != null;    
}     

http://blogs.edwardwilde.com/2009/12/17/programmatically-determine-is-a-feature-is-activated-or-even-installed/

This method is better and less hassle / a method that i would recommend!

다른 팁

What version of SharePoint are you using? I may have some old solutions that I deployed that were SharePoint Web Services I can use as reference to try to help. From what I recall with SharePoint 2010, all you do is deploy it to the ISAPI folder and you should be able to call it in your code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top