Hello John,
From your description, I understand you're going to prevent the
autogenerated WSDL document( **.asmx?WSDL ) from being visited by users but
still allow the display of the default webservice main helper page, correct?
As for the exception you encountered, it is an expected one and you haven't
missed any particular things. Actually, the cause of the problem is that
the "Documentation" protocol you configure through the (<protocols>
collection) controls both the webservice helper document page and the WSDL
document's generation, therefore, if you remove it from the <protocols>
collection, the end user will no longer be able to visit the .asmx or
..asmx?WSDL from browser.
So far based on my research, if we want to display customized content for
our asmx webservice, we still have to leave the "documentation" protocol
enable(do not remove it from the <protocolscollection). And use the
<wsdlHelperGenerator to configure a custom helper page.
As for the WSDL document(display through ".asmx?WSDL"), we can not
completely disable it , however, there is a means that we configure our
webservice/webmethod to use a custom WSDL document(by specifying a
webservice binding). e.g.
====================
[WebServiceBinding( Name="MyBinding", Location = "CustomWSDLPage.aspx")]
public class SimpleService : System.Web.Services.WebService
...............
[SoapDocumentMethod(Binding="MyBinding")]
public string HelloWorld()
{
...........
====================
Thus, the original WSDL document(display through .asmx?WSDL) will display
few WSDL elements(only the sevice address ) and will redirect the service
description to our custom location. You can have a look at the following
article for the detailed description on using a custom WSDL document for
ASP.NET webservice.
#Using a Custom WSDL File in ASP.NET Web Services
http://pluralsight.com/blogs/craig/a.../15/17482.aspx
Hope this helps some. Please feel free to let me know if there is anything
else we can help.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.