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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:19:49+00:00 2026-06-05T19:19:49+00:00

We have a ASP.NET website project. In the past, we had been using asmx

  • 0

We have a ASP.NET website project. In the past, we had been using asmx webservice. Now, we have WCF service, and I am trying to call a WCF service using client proxy object with jQuery. With asmx, it was fairly easy to call a webservice with folllowing lines of code

function GetBooks() {
    $.ajax({
        type: "POST",
        data: "{}",
        dataType: "json",
        url: "http: /WebService.asmx/GetBooks",
        contentType: "application/json; charset=utf-8",
        success: onSuccess
    });
}

and the method in WebService class is

[WebMethod(EnableSession = true)]
public Books[] GetBooks()
{
       List<BooksTO> dtos = BooksDTOUtils.GetBooks(entityOwnerID);
       return dtos.ToArray();
}

Now, GetBooks_Wcf() method has to be called from jQuery. I am using a client proxy in new class (WcfCall.cs) to call wcf method GetBooks

  public Books[] GetBooksWcf()
{
        var service = WcfProxy.GetServiceProxy();
        var request = new GetBooksRequest();
        request.entityOwnerID= entityOwnerID;
        var response = service.GetBooks(request);
        returnresponse.Results.ToArray();
}

and my Proxy (Wcfproxy.cs) is

 public static Service.ServiceClient GetServiceProxy()
{
    var Service = Session["Service"] as Service.ServiceClient;
    if (Service == null)
    {
        // create the proxy
        Service = CreateServiceInstance();

        // store it in Session for next usage
        Session["Service"] = Service;
    }

    return Service;
}

   public static Service.ServiceClient CreateServiceInstance()
   {
    ServicePointManager.ServerCertificateValidationCallback = new        RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler);

    string configValue = Environment.GetConfigSettingStr("WcfService");

    Service.ServiceClient webService = new Service.ServiceClient();
    //Here is my WCF endpoint
    webService.Endpoint.Address = new System.ServiceModel.EndpointAddress(configValue);

    return webService;
}

So, my question is how do I call GetBooksWcf from jQuery? I have created a reference.cs, and Service.ServiceClient from above method is in reference.cs below. Also, the parameter “entityOwnerID” is sensitive and I cannot pass it from JQuery, either I have to persist it or call from web.config as key.

 [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  public partial class ServiceClient : System.ServiceModel.ClientBase<Service.IService>, Service.IService
  {
      .........  
   } 

Thanks in advance!

  • 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-06-05T19:19:50+00:00Added an answer on June 5, 2026 at 7:19 pm

    The .NET proxy for your WCF service cannot be used as-is in jQuery.

    You need to enable your WCF service to be consumed via JavaScript or jQuery by using AspNetCompatibilityRequirements and WebInvoke attributes (see here).

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

Sidebar

Related Questions

I want to configure ASP.NET Website Project using WCF Service[NetTcp] (both in c#) for
I have done hands full of project with AspNetSqlMembershipProvider. Now, I have asp.net website
i have a problem i am developing an asp.net mvc project. Website is in
I have a ASP.NET website deployed under IIS uisng virtual directories. I'm using forms
I have an ASP.NET website set up, and I'm using Google Analytics for page
I have a asp.net website and I am accessing that web service from my
I have an ASP.NET website where i have implemented page level caching using the
I have asp.net 4 webforms website which references PortableLibrary project. In the website I
I have the following: ASP.NET website using the 3.5 framework One folder that contains
Hello I have a page in an ASP.NET (website) project that writes a file

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.