I am attempting to utilize a web service within my web application developed in Visual Studio 2012.
Below is the code for my web service:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()>
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")>
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<ToolboxItem(False)>
Public Class WebService1
Inherits System.Web.Services.WebService
<WebMethod()>
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
My web.config configuration:
<system.web>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx"
type="System.Web.Script.Services.ScriptHandlerFactory"
validate="false"/>
</httpHandlers>
....
</system.web>
Declared on the site.master
<asp:ScriptManager runat="server">
<Services>
<asp:ServiceReference
path="../WebService1.asmx" />
</Services>
.....
</asp:ScriptManager>
The call from JavaScript triggered by a button
function provaWebService() {
alert("entrato")
WebService1.HelloWorld(onSuccess);
}
function onSuccess(result) {
alert(result)
}
I'm encountering an error in Firefox console: ReferenceError: WebService1 is not defined
and
ReferenceError: Type is not defined
Can someone provide some assistance?