.NET Forum / .NET Framework / XML / July 2006
Follow up question on hiding web service functions
|
|
Thread rating:  |
John K - 08 Jul 2006 18:05 GMT It seems to work, at least my application still works. After adding this tag to hide the documentation; is it normal to see an error message when browsing to the page? I get error message shown below when going to that page in Internet Explorer on the same machine as the service. If I understand correctly; to correct this error I simply need to have the following in web.config:
<webServices> <protocols> <remove name="Documentation" /> </protocols> <wsdlHelpGeneratorhref="helpPage.aspx"/> </webServices>
Thus it seems like, in this example, all I need to do is have a web page named helpPage.aspx. Is this true? Could the wsdlHelpGeneratorhref be a simple .htm page?
Here is the error I referred to above:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Request format is unrecognized.] System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +491033 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +104 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Thank you.
 Signature Thank you.
Steven Cheng[MSFT] - 10 Jul 2006 06:40 GMT Hello KTJ,
Thank you for posting in the MSDN newsgroup.
As for the "[InvalidOperationException: Request format is unrecognized.]" error you mentioned, it is due to the "Documentation" protocol is disabled so that when we request the asmx url in webbrowser, the ASP.NET runtime will report such error.
Actually, after we remove the "Documentation" protocol as below:
=================== <webServices> <protocols> <remove name="Documentation" /> </protocols> ===============
Neither the built-in helper page nor our custom helper page(configure through the <wsdlHelpGenerator href="CustomWSDLPage.aspx"/> element) can be visisted through webbrowser. Therefore, if you want to use custom WSDL or documentation page, you need to remove the following configuration element from your application's web.config file.
<remove name="Documentation" />
In addition, the custom WSDLhelper page doesn't support pure html file, you need to create an ASPX page as the custom WSDL helper page.
If there is anything else unclear, please feel free to post here.
Regards,
Steven Cheng Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 Signature Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
John K - 10 Jul 2006 13:31 GMT Hello Steven,
Thank you. So if I understand correctly; all I need to do to hide the functions and display another page is to use the wsdlHelpGeneratorhref tag in the WebServices section; as shown below? Is this correct?
<webServices> <wsdlHelpGeneratorhref="helpPage.aspx"/> </webServices>
 Signature Thank you.
> Hello KTJ, > [quoted text clipped - 45 lines] > (This posting is provided "AS IS", with no warranties, and confers no > rights.) Steven Cheng[MSFT] - 11 Jul 2006 04:09 GMT Hello KTJ,
Thanks for your response.
Yes, you're right. You should remove those protocol disabling cofiguration(as below) if you want to allow the client user visit webservice description page(built-in or our custom one) in web browser
==================== <webServices> <protocols> <remove name="Documentation" /> </protocols> =====================
Actually, this is true for any other protocols(such as HttpGet, HttpPost, HttpSoap). Whenever you disable (by using the <remove name=xxx> element) in web.config, the webservice clients no longer be able to communicate with the service through that disabled protocol:
http://msdn2.microsoft.com/en-us/library/ccbk8w5h.aspx
If you still have any questions or any other things we can help, please feel free to let me know.
Regards,
Steven Cheng Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 Signature Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
John K - 11 Jul 2006 13:40 GMT Thank you. However, I am still confused. Would the configuration below both hide the function names/declarations and automatically route the user to the helpPage.aspx file?
<webServices> <protocols> <remove name="Documentation" /> </protocols> <wsdlHelpGeneratorhref="helpPage.aspx"/> </webServices>
 Signature Thank you.
> Hello KTJ, > [quoted text clipped - 38 lines] > (This posting is provided "AS IS", with no warranties, and confers no > rights.) Steven Cheng[MSFT] - 11 Jul 2006 13:53 GMT Thanks for your reply KTJ,
The <remove name="Documentation" /> element means you will disable the "documentation" functionality of the ASP.NET webservice(asmx). In other word, this will prevent the user from being able to see the function names/declarations or your custom Documentation page(your helpPage.aspx).
Therefore, if you want to redirect the client user to your custom helpPage.aspx page, you can not include
<remove name="Documentation" />
And your complete webservices configuration section should look like:
================== <webServices> <wsdlHelpGeneratorhref="helpPage.aspx"/> </webServices> ===================
Hope this help clarify it. Please feel free to let me know if you still have anything unclear.
Regards,
Steven Cheng Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 Signature Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
Steven Cheng[MSFT] - 13 Jul 2006 14:59 GMT Hello KTJ,
How are you dong on this thread, have you got any further ideas on this or does my last reply helps clarify this further? If there is still anything unclear, please feel free to let me know.
Regards,
Steven Cheng Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 Signature Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
John K - 18 Jul 2006 20:43 GMT Hello Steven,
There is a minor bug in the line:
<wsdlHelpGeneratorhref="helpPage.aspx"/>
there should be a space between wsdlHelpGenerator and href
thus, I found out it should be:
<wsdlHelpGenerator href="helpPage.aspx"/>
It works. I am all set. Thank you.
 Signature Thank you.
> Hello KTJ, > [quoted text clipped - 19 lines] > (This posting is provided "AS IS", with no warranties, and confers no > rights.) Steven Cheng[MSFT] - 19 Jul 2006 02:38 GMT Thanks for your followup KTJ,
Yes, it's my type mistake in the original posted <wsdlHelpGenerator ... > element, also thank you for pointing it out. I'm glad that you've got it working. If you have meet any new problems later, please feel free to post here.
Have a good day!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|