Calling WebService from Javascript Error

I recently wasn getting the following error when trying to call a webservice from javascript.

“Request format is unrecognized for URL unexpectedly ending in ‘/Search’.”

I was able to invoke the web services from the test page offered by visual studio, but accessing it outside the invoke method on the test page would not work.

By default, webservices protocols are not added to the webconfig. To access normal get/post services you will need to add the following in the <system.web> node.

[codesyntax lang=”xml”]

<webServices>
<protocols>
<add name=”HttpPost”/>
<add name=”HttpGet”/>
</protocols>
</webServices>

[/codesyntax]