Most frustratingly, I got stuck on the javascript code calling the webservice. Simply, I didn't realize the function takes in one more parameter than the web service requires. For example, I created a webservice "RepeatResponse(string UserInput)" which would mean that the javascript code would be "[namespace].[class].RepeatResponse("blah blah", [functionName]);" where functionName is a javascript function that will run when the web service responds.
For whatever reason, I did not think about it until I almost gave up and started to remove the javascript for ASP.NET's ScriptManager. While considering the pseudo-code in my head, I realized that I needed to execute a function when the web service responds which caused the light bulb to go off.
The other difficulty is troubleshooting the issue. Although I can break within the javascript, there is no error when the function is called. The only response I received was null.
Overall, there were a few other hiccups in fixing the setup of web services in Visual Studio. So far, I think it may have actually been easier to just use a simple JSON function to execute the web service. I have not found any strong evidence of using ScriptManager over regular JSON.
Note:
To implement ScriptManager, web.config also needs to be updated to include the ScriptHandlerFactory.
<system.webServer>Reference
<handlers>
<add name="ScriptHandlerFactory" path="*.asmx" verb="*"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
modules="ManagedPipelineHandler"
scriptProcessor=""
resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false"
preCondition="integratedMode"
responseBufferLimit="4194304"
/>
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
https://msdn.microsoft.com/en-us/library/bb763183.aspx - Sample in link does not work
No comments:
Post a Comment