Estou tentando acessar um WebService através do Sys.Net.WebServiceProxy.invoke.
Eu já tenho um programa que faz isso e funciona perfeitamente, mas quando eu fui fazer o mesmo procedimento nesta nova aplicação, o Web service não é acessado de jeito nenhum:
Meu HTML:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="Testinando_2010._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript" src="Scripts/scripts.js"></script>
<asp:ScriptManager ID="manager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
<h2>
Welcome to ASP.NET!
</h2>
<p>
To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
</p>
<p>
You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409"
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
</p>
<input type="button" value="clique" onclick="pegar()"/>
</asp:Content>
Meu javascript:
function pegar() {
Sys.Net.WebServiceProxy.invoke('../servico/servico.asmx', "HelloWorld", false, "", mostra);
alert('');
}
function mostra(t){
alert(t);
}
Meu WebService:
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 servico
Inherits WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
o Prpjeto:
