none
RESTFul API WebGet attribute methods which defined as void working successfully in JQuery 1.6.4 but throwing exception in JQuery 2.1.3

    Question

  • I am facing a critical problem in my project which is mentioned below:

    New version of JQuery 2.1.3 doesn’t support RESTFul API WebGet attribute methods which had been defined as void, as a result it was throwing the exception. Only GET( HTTPVerbs) method successfully running when we defined as with return value.

     Even I tried with RESTFul API WebInvoke and in this case also latest version of JQuery 2.1.3 could not able to execute those  GET(HTTPVerbs)method Which had been defined as void. Same as GET(HTTPVerbs) method successfully running when we defined as with return value.

    Below is the example, In RESTFul service Get Method which I defined as void throws an exception when it is executing from Client side using JQuery 2.1.3 but same thing was executing successfully using JQuery 1.6.4 :

    RESTFul Service:

    IComponentService.cs 

    [OperationContract]

    [WebGet(ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json)]

    void Delimiter(string reqDelimiter,string clientSessionID);

    ComponentService.cs 

    public void Delimiter(string reqDelimiter,string clientSessionID)

    {

      //Code implementation here

    }

    ClientSide:

    var inputd = { "clientSessionID": clientSessionID, "reqDelimiter": "|" };

    $.ajax({

    type: "GET",

    url: configurationSetting + "Delimiter",

    async: false,

    data: inputd,

    dataType: "JSON",

    processdata: "false",

    success: function (result) {

    alert("inside Delimiter success" + result);

    },

    error: function (result) {

    alert("Browser Independence Service is not running");

    PageMethods.LogoutSession();

    }

    });

    When we defined above method in RESTFul service as with return type then from client side it is executing successfully using JQuery 2.1.3:

    IComponentService.cs 

    [OperationContract]

    [WebGet(ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json)]

     int Delimiter(string reqDelimiter,string clientSessionID);

    ComponentService.cs 

    public int Delimiter(string reqDelimiter,string clientSessionID)

    {

       int response= 0;

      //Code implementation here

      return response;

    }

    ClientSide:

    var inputd = { "clientSessionID": clientSessionID, "reqDelimiter": "|" };

    $.ajax({

    type: "GET",

    url: configurationSetting + "Delimiter",

    async: false,

    data: inputd,

    dataType: "JSON",

    processdata: "false",

    success: function (result) {

    alert("inside Delimiter success" + result);

    },

    error: function (result) {

    alert("Browser Independence Service is not running");

    PageMethods.LogoutSession();

    }

    });

    Please help me about below query, 

    1) why this differentiation in JQuery 1.6.4 version and JQuery 2.1.3 version?

    2) Is there any way so that code which was successfully running in JQuery 1.6.4 can execute also in JQuery 2.1.3 without any exception?

    Thanks in advance.

    Regards,

    Sanjoy

    Monday, June 15, 2015 8:34 AM

Answers

  • Might try them over here.

    http://forums.asp.net/

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Monday, June 15, 2015 9:33 AM
    Moderator