Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Web service object not recognized in Javascript code... what am I missing

$
0
0

Hello,

I am running into an issue trying to set up my web service and calling it via my javascript.  My webservice is defined like:

[WebService(Namespace = "http://tempuri.org/")]    

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    

 [System.ComponentModel.ToolboxItem(false)]     

 [ScriptService]    

public class NameService : System.Web.Services.WebService {

        [WebMethod]        

       public string HelloWorld(string yourName) {             return string.Format("Hello {0}", yourName);         }     }

 

In my ASPX page I am using a ScriptManagerProxy like:

<asp:ScriptManagerProxy runat="server" ID="scriptManagerProxy1"> 

    <Services>          

         <asp:ServiceReference Path="~/WebServices/NameService.asmx" />        

    </Services>  

</asp:ScriptManagerProxy>

Then my javascript looks like:

function Test(name) {

      NameService.HelloWorld(name, MyCallback);

}

 

The problem is that I am getting an error that NameService is undefined.  I am not sure what I am missing.   According to everything I can find, it should be known in the client but I am new to ASP.NET AJAX so who knows?

Any thoughts? - Peter


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>