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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:04:27+00:00 2026-05-23T17:04:27+00:00

I have a WCF service, this is a method which I’d to call: [OperationContract]

  • 0

I have a WCF service, this is a method which I’d to call:

    [OperationContract]
    [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
    double?[] GetPoints(string tourname);

I checked by WCF Test Client, it works fine

So I need to call this method from html page. It should work from other computer that is cross-domain.

I wrote somethig using jQuery 1-6-2.min.js:

var varType;
var varUrl;
var varData;
var varContentType;
var varDataType;
var varProcessData;

function CallService() {
        alert("CallService");
                $.ajax({
                    type          : varType, //GET or POST or PUT or DELETE verb
                    url           : varUrl, // Location of the service
                    data          : varData, //Data sent to server
                    contentType   : varContentType, // content type sent to server
                    dataType      : varDataType, //Expected data format from server
                    processdata   : varProcessData, //True or False
                    success       : function(msg) {//On Successfull service call
                    ServiceSucceeded(msg);                    
                    },
                    error: ServiceFailed// When Service call fails
                });
        }

function Start() {
    varType = "POST";
    varUrl = "http://localhost:1592/TourService.svc/GetPoints";
    varData = '{"tourname ":"customname"}';
    varContentType = "application/json; charset=utf-8";
    varDataType = "json";
    varProcessData = true; 
    CallService();
}

function ServiceSucceeded(result) {
    alert("ServiceSucceeded");
    alert(result);
}

function ServiceFailed(result) {
    alert('Service call failed: ' + result.status + ' ' + result.statusText);
    varType = null;
    varUrl = null;
    varData = null;
    varContentType = null;
    varDataType = null;
    varProcessData = null;
}

However ServiceFailed function is invoked with message “Service call failed 0 error”

How to make a cross-domain calling of WCF service?(using jQuery or not)

Thanks

  • 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-23T17:04:28+00:00Added an answer on May 23, 2026 at 5:04 pm

    Basically you need to be using jSONP instead of jSON:

    Using jQuery & JSONP for cross-domain AJAX with WCF services

    I’ll provide a summary shortly in case this link disappears.

    Also see the jQuery documentation for more about how to use jSONP, jQuery & AJAX

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

Sidebar

Related Questions

Hello I have a simple wcf service like this, with a test method which
I have a quite simple WCF service method which returns an IQueryable, just for
I have a WCF service method which I have written for return type as
Let's say I have a WCF service which has a method returning object Person.
I have a WCF Service which I am calling asychronously. If I call a
I have a WCF service method which takes more than two hours to execute
I have created a WCF service, now this WCF service has to call a
I have a WCF service which has one method returning a stream. [ServiceContract] public
I have a WCF service that exposes 1 method GetNextObjectInList(int id) which hits a
I have created a basic WCF service in IIS. I am aware that this

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.