You must Sign In to post a response.
  • Category: ASP.Net MVC

    How to access remote XML webservice in Jquery or webapi?

    I have a remote xml webservice like which will return xml data.
    I am getting error as below

    XMLHttpRequest cannot load . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost is therefore not allowed access.

    I tried to use jsonp but its not working because returned data is xml.
    So how to avoid this cross origin error

    my code is below

    method: 'get',
    params: data,
    url: '',
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    dataType: "text",
    beforeSend: function (xhr) {
    xhr.setRequestHeader('Access-Control-Allow-origin', 'true');

    contentType: 'text/plain',
    crossDomain: true,
    xhrFields: {
    withCredentials: true

    success: successFunction,
    error: errorFunction

    Please suggest.Also suggest how to implement with webapi. Provide me links as well as steps i need to follow to solve this issue
  • #763174
    Hi Jeevan.

    You can refer below forum links of dotnetspider, the same question has been asked earlier.
    It may help you to achieve your task.

    Sridhar Thota.
    Editor: DNS Forum.

Sign In to post your comments