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
iireset
to apply those changes.If removing those protocols is too much, you can instead remove an handler:
If the
?wsdl
is 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.Web
assembly.DisableWSDLModule
and 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}\bin
folder. If the 'bin
' folder does not exist, create it.Modify the
web.config
file 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
PublicKeyToken
using thesn.exe
tool 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\assembly
folder. This will make the module available to all SharePoint web applications.Modify the
web.config
files 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 thePublicKeyToken
using thesn.exe
tool or by examining the DLL properties in Windows Explorer.Finally, as usual,
iireset
.