Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3217292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:23:39+00:00 2026-05-17T15:23:39+00:00

Ok, this is one of these basic questions, but I’ve googled and debugged now

  • 0

Ok, this is one of these basic questions, but I’ve googled and debugged now for two hours and the error escapes me.

Simple scenario: WCF service with methods with parameters which I’d like to call through jquery. I can call methods without params alright, but with params, the call never makes it to my breakpoint in .NET.

ServerCode:

[ServiceContract(Namespace = "http://www.myhost.de")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService
{
    [OperationContract]
    public int TestMeWithParam(int lastId)
    {
        return lastId;
    }

    [OperationContract]
    public int TestMe()
    {
        return 5;
    }
}

Javascript code

function BaseServiceCall(serviceName, dataInput, successCB, errorCB) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: BaseUrl + "Services/MyService.svc/" + serviceName,
        data: dataInput,
        dataType: "json",
        timeout: 2000,
        success: successCB,
        error: errorCB
    });
}

function ServiceGetMessages(lastMessageId, successCB, errorCB) {
    BaseServiceCall("TestMeWithParam", "{'lastId':'17'}", successCB, errorCB);
    //BaseServiceCall("TestMe", "", successCB, errorCB);
}

So, if I call the TestMe service it returns 5. It works. TestMeWithParam never gets called.

What’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:23:39+00:00Added an answer on May 17, 2026 at 3:23 pm

    So, now it works. I am not very sure why, since I didn’t change a lot. I fear one factor was that my timeout was too small for debugging (but even then it should have worked).

    So, now the server code which works for me (with and without params)

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class MyService
    {
        [OperationContract]
        public int TestMeWithParam(int lastId)
        {
            return lastId;
        }
    
        [OperationContract]
        public int TestMe()
        {
            return 5;
        }
    }
    

    As I have read somewhere else, no WebInvoke is needed at all. Just the plain standard.

    Client code:

    function BaseServiceCall(serviceName, dataInput, successCB, errorCB) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: BaseUrl + "Services/MyService.svc/" + serviceName,
        data: dataInput,
        dataType: "json",
        timeout: 200000,
        success: successCB,
        error: errorCB
    });
    }
    

    function ServiceGetMessages(lastMessageId, successCB, errorCB) {
    BaseServiceCall(“TestMeWithParam”, ‘{“lastId”:”‘ + lastMessageId + ‘”}’, successCB, errorCB);
    //BaseServiceCall(“TestMe”, ‘””‘, successCB, errorCB);
    }

    I changed the quotation marks as suggested by Mouhannad, even though I am sure that I tried that before.

    I also tried without the “lastId” which did not work.

    I had this experience before with WCF: you play around and play around, then it works and you are not sure why. 🙁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of those I probably should know this, but I don't questions.
I know there are questions similar to this one, but I've not found a
Sorry for this simple questions but i am too much confused with how to
What's the difference between these: This one works: char* pEmpty = new char; *pEmpty
This is homework, and this questions Extends this one So there is a button
Hey, so this is one of those questions that seems obvious, and I'm probably
Is there any way to have this: [one[two]][three] And extract this with a regex?
I know there are a lot of similar questions to this one around Stack
I have some basic questions with regards to portal framework - sorry if these
I've seen questions similar to this one and I've read and re-read them over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.