Hi,
I have create o javascript file which will communicate with webservice with Sys.Net.WebServiceProxy.invoke.
I have a exemple like this and it works fine, but when I tried to create another application, even I using the code from the first exeample, does'nt work.
My 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>My javascript:
function pegar() {
Sys.Net.WebServiceProxy.invoke('../servico/servico.asmx', "HelloWorld", false, "", mostra);
alert('');
}
function mostra(t){
alert(t);
}My 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 ClassLike I said, I already have an application that works fine, but even if I copy and paste the code in another application, the web service doesn't work.