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 132203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:13:32+00:00 2026-05-11T06:13:32+00:00

I have a WCF service that takes as a parameter a string value name.

  • 0

I have a WCF service that takes as a parameter a string value ‘name’. This service interface looks like this…

[ServiceContract(Name = 'ContactLookup', Namespace = 'Search')] public interface IAjaxResultSearcherService {     [OperationContract]     [WebGet(RequestFormat = WebMessageFormat.Json)]     Result[] SearchResultsWithNameLike(string name); } 

The service is exposed to using the following configuration…

<system.serviceModel>     <serviceHostingEnvironment aspNetCompatibilityEnabled='true' />     <behaviors>         <serviceBehaviors>             <behavior name='AjaxServiceBehavior'>                 <serviceDebug                        includeExceptionDetailInFaults='true'                         httpHelpPageEnabled='true'/>                 <serviceMetadata httpGetEnabled='true' httpGetUrl=''/>                 <serviceCredentials>                     <serviceCertificate findValue='localhost'                                   storeLocation='LocalMachine'                                   storeName='My' x509FindType='FindBySubjectName'/>                 </serviceCredentials>             </behavior>         </serviceBehaviors>         <endpointBehaviors>             <behavior name='JsonBehavior'>                 <enableWebScript/>             </behavior>         </endpointBehaviors>     </behaviors>     <services>         <service name='HelloIndigo.AjaxResultSearcherService'                               behaviorConfiguration='AjaxServiceBehavior'>             <endpoint address='json'                       binding='webHttpBinding'                   behaviorConfiguration='JsonBehavior'                       contract='Contract.IAjaxResultSearcherService' />         </service>     </services> </system.serviceModel> 

My .svc file uses the WebScriptServiceHostFactory. This seems to be working, meaning that I can connect to the service from my jquery client, but even though I set the parameter value via the ajax call, when the message gets to the service implementation, the parameter value is null.

I am calling the service via jquery like so…

$.ajax({     url: url,     data: { 'name':'test' },     type: 'GET',     processData: false,     contentType: 'application/json',     timeout: 10000,     dataType: 'text',     success: function(res) {         alert('function successful! returned: ' + res.toString());     },     error: function(xhr) {         alert('an error occurred: ' + xhr.responseText);     } }); 

I get no errors from the service call, but when I debug the process, the parameter value is null. Why won’t WCF pass parameter values like I expect?

Thanks for the help.

  • 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. 2026-05-11T06:13:33+00:00Added an answer on May 11, 2026 at 6:13 am

    In my trials I was trying to use JSON.org’s JSON2 to ‘stringify’ my json object and pass it to the ajax call as the data object, and had set the processData parameter to false. Once I decided to leave the data elements as native JSON objects and set processData to true, my parameter values were populated.

    I am still not sure why JSON2.js’s stringify did not make the data parameter valid, but at least this is working.

    So, previously I had the following:

    var json = JSON.stringify({ 'name':'test' }); $.ajax({     url: url,     data: json,     type: 'GET',     processData: false,     contentType: 'application/json',     timeout: 10000,     dataType: 'text',     success: function(res) {         alert('function successful! returned: ' + res.toString());     },     error: function(xhr) {         alert('an error occurred: ' + xhr.responseText);     } }); 

    The working version, however looks like this…

    var json = { 'name':'test' }; $.ajax({     url: url,     data: json,     type: 'GET',     processData: true,     contentType: 'application/json',     timeout: 10000,     dataType: 'text',     success: function(res) {         alert('function successful! returned: ' + res.toString());     },     error: function(xhr) {         alert('an error occurred: ' + xhr.responseText);     } }); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do this instead: public enum MyKeys { Key1, Key2, Key3… May 11, 2026 at 11:38 pm
  • Editorial Team
    Editorial Team added an answer A rule would be considered: p {…} A selector in… May 11, 2026 at 11:38 pm
  • Editorial Team
    Editorial Team added an answer There are some different ways. Plain string methods: Dim left… May 11, 2026 at 11:38 pm

Related Questions

I'm now toying around with WebServices, using the .NET framework (.asmx files, not WCF).
I need to host a WCF service in IIS that exposes a wsHttpBinding. That
Haven't seen many Geneva related questions yet, I have posted this question in the
I am debugging an ASMX web service that receives bursts of requests. i.e., it

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.