Calling Web Service from ASP.NET AJAX

Discussion in 'ASP .Net Web Services' started by NBD, Sep 27, 2007.

  1. NBD

    NBD Guest

    Hi,

    I am getting a 'web service undefined' error when calling a web service from
    Javascript which I've defined inside the ScriptManager tag like so:

    <asj:ScriptManager ID="ScriptManager1" runat="server">
    <Services>
    <asj:ServiceReference Path="~/Services/MyWS.asmx" InlineScript
    ="True" />
    </Services>
    </asj:ScriptManager>

    I'm calling the service from Javascript function like so:

    function CallWS()
    {
    Namespace.MyWS.MyMethod(var);
    }

    The error message says that the class is 'undefined'. I've tried different
    variations of namespaces and class names but no dice..

    Any help is appreciated.

    Thanks,

    NBD
     
    NBD, Sep 27, 2007
    #1
    1. Advertising

  2. NBD

    NBD Guest

    I used Fiddler to catch the network messages and I got this:


    System.InvalidOperationException: jsdebug Web Service method name is not
    valid.
    at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
    HttpContext context, HttpRequest request, HttpResponse response, Boolean&
    abortProcessing)

    The method is pretty straigthforward - three ByVal input params (all string
    type). I have also set the attribute of the class to <ScriptService()> _

    Would anyone know why the method name is not valid?

    NBD

    "NBD" wrote:

    > Hi,
    >
    > I am getting a 'web service undefined' error when calling a web service from
    > Javascript which I've defined inside the ScriptManager tag like so:
    >
    > <asj:ScriptManager ID="ScriptManager1" runat="server">
    > <Services>
    > <asj:ServiceReference Path="~/Services/MyWS.asmx" InlineScript
    > ="True" />
    > </Services>
    > </asj:ScriptManager>
    >
    > I'm calling the service from Javascript function like so:
    >
    > function CallWS()
    > {
    > Namespace.MyWS.MyMethod(var);
    > }
    >
    > The error message says that the class is 'undefined'. I've tried different
    > variations of namespaces and class names but no dice..
    >
    > Any help is appreciated.
    >
    > Thanks,
    >
    > NBD
    >
    >
     
    NBD, Sep 28, 2007
    #2
    1. Advertising

  3. first u need u add web referencce to ur web service
    then u can access. u r getting error at compile time or runtime

    "NBD" wrote:

    > Hi,
    >
    > I am getting a 'web service undefined' error when calling a web service from
    > Javascript which I've defined inside the ScriptManager tag like so:
    >
    > <asj:ScriptManager ID="ScriptManager1" runat="server">
    > <Services>
    > <asj:ServiceReference Path="~/Services/MyWS.asmx" InlineScript
    > ="True" />
    > </Services>
    > </asj:ScriptManager>
    >
    > I'm calling the service from Javascript function like so:
    >
    > function CallWS()
    > {
    > Namespace.MyWS.MyMethod(var);
    > }
    >
    > The error message says that the class is 'undefined'. I've tried different
    > variations of namespaces and class names but no dice..
    >
    > Any help is appreciated.
    >
    > Thanks,
    >
    > NBD
    >
    >
     
    Som Nath Shukla, Oct 3, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    2
    Views:
    661
    Steven Cheng[MSFT]
    Oct 1, 2004
  2. hocho888
    Replies:
    1
    Views:
    649
  3. Michael Averstegge
    Replies:
    0
    Views:
    4,244
    Michael Averstegge
    Jan 10, 2006
  4. mark4asp
    Replies:
    1
    Views:
    1,157
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Mar 24, 2007
  5. Not Me
    Replies:
    1
    Views:
    3,191
    Not Me
    Jun 5, 2007
Loading...

Share This Page