we want to disable the WSDL generation of sharepoint webservices. e.g.
http://baseaddress/_vti_bin/lists.asmx?wsdl
To enable this we have done the following:
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\web.config added entry
<system.web> <webServices> <protocols> <remove name="Documentation /> </protocols> </webservices> </system.web>
Adding the above entry, stops users from accessing this url: http://baseaddress/_vti_bin/lists.asmx but if a user append ?wsdl at the end of url, the WSDL still get generated.
Then we have updated the following entry in the same web.config file:
<location path="wswsdl.aspx"> <system.web> <authorization> <deny users="*"/> </authorization> </system.web> </location>
i have also changed all the endpoints with httpGetEnabled="false" from httpGetEnabled="true" but still no effect
however the wsdl is still getting generated, is there anything further we can do to disable wsdl generation please?
From this thread, you can remove/disable web service protocols.
As a test, try in your
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\web.config:From this thread, you would need at least an
iiresetto apply those changes.If removing those protocols is too much, you can instead remove an handler:
If the
?wsdlis still accessible, you might consider implementing a custom HTTP module to intercept the incoming request and block it if it contains the '?wsdl' query string.System.Webassembly.DisableWSDLModuleand replace its contents with the following code:Try and:
Build the project and obtain the resulting DLL file from the bin folder.
Deploy the DLL to the SharePoint server by copying it to the
C:\inetpub\wwwroot\wss\VirtualDirectories\{your-web-application-port}\binfolder. If the 'bin' folder does not exist, create it.Modify the
web.configfile in the SharePoint web application folder (C:\inetpub\wwwroot\wss\VirtualDirectories\{your-web-application-port}\web.config) to register the custom HTTP module.Add the following entry inside the
<system.webServer><modules>sectionReplace
[Your DLL name]and[Your PublicKeyToken]with the appropriate values for your compiled DLL.You can obtain the
PublicKeyTokenusing thesn.exetool or by examining the DLL properties in Windows Explorer.After an
iireset, any incoming request containing the '?wsdl' query string should be blocked with a 403 Forbidden response.That would be a workaround, to disable WSDL generation for your SharePoint web services.
Then try:
Create a custom HTTP module as described in above. This module will intercept incoming requests and block them if they contain the '
?wsdl' query string.Deploy the custom HTTP module's DLL to the SharePoint server's Global Assembly Cache (GAC) by copying it to the
C:\Windows\assemblyfolder. This will make the module available to all SharePoint web applications.Modify the
web.configfiles of the SharePoint web applications for which you want to disable WSDL generation. You can find these files in theC:\inetpub\wwwroot\wss\VirtualDirectories\{your-web-application-port}folders.Add the following entry inside the <system.webServer> section of each web.config file:
Replace
[Your DLL name]and[Your PublicKeyToken]with the appropriate values for your compiled DLL. You can obtain thePublicKeyTokenusing thesn.exetool or by examining the DLL properties in Windows Explorer.Finally, as usual,
iireset.