• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 478
  • Last Modified:

invalid web service call missing value for parameter

I am calling a Webmethod via jquery ajax call.

Here is my ajax method
 jQuery.support.cors = true;
            type: "GET",
            url: "mypage.aspx/GetConnectionDetail", 
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify({ "Id": Id, "accountKey": accountKey, "securityKey": securityKey, "connectionGUID": connectionGUID }),
            dataType: "json",

Open in new window

Here is my c# web method
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
  public static string GetConnectionDetail(string Id, string accountKey, string securityKey, string connectionGUID)
            return "my connection";

Open in new window

When i am calling this method via POST Request it works fine but as i start calling the same method via GET request i am getting
invalid web service call missing value for parameter u0027/Id/u0027
. I debug my jquery function for missing parameters but the parameter is not missing. and if i switch to POST request it works fine.
Rohit Sharma
Rohit Sharma
  • 2
1 Solution
Chris StanyonCommented:
My guess here is that you are trying to JSONify your data for a GET request. No need - a GET request should be passed as a querystring. Just use the data argument like so:

data: {
    "Id": Id,
    "accountKey": accountKey,
    "securityKey": securityKey,
    "connectionGUID": connectionGUID

Open in new window

jQuery will then automatically create the querystring for you.
Rohit SharmaAuthor Commented:
Thanks for your reply Chris Stanyon

this will not work as it throw a error  
Invalid JSON primitive
Chris StanyonCommented:
Ok. I think you need to remove the contentType  argument from your AJAX call as you're no longer sending it across as JSON. Remove this line:

contentType: "application/json; charset=utf-8",
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now