Is it possible to use a custom WSDL with a .NET WebService? I would like to use a custom WSDL with my .NET WebService instead of the one generated by .NET as part of my WebService.
Actually there is a way to do this: You can create your own WSDL (i.e. removing methods you don't want to publish) and then make it available at a dedicated spot, this allows users to bind to it as normal.
To prevent users from just retrieving the default WSDL (foo.asmx?wsdl
) you have to flip a switch in the web.config of your web service:
<webServices>
<protocols>
<remove name="Documentation"/>
</protocols>
</webServices>
From the relevant MSDN section:
Note Removing the Documentation protocol also disables WSDL file generation for any XML Web services within the Web application. This prevents clients from generating a proxy class unless a custom WSDL file is created and provided for them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With