I want to download wsdl file programmaticaly, using my Web JavaScript application. First I do Oauth login and get all tokens. Then I try to download WSDL file using JavaScript:

        var xmlHttp = new XMLHttpRequest();
        xmlHttp.onload = function () {
        xmlHttp.open("GET", "https://ap1.salesforce.com/soap/wsdl.jsp", true);
        xmlHttp.setRequestHeader("Authorization", "Bearer " + accessToken);

When this code executes I always get error :

XMLHttpRequest cannot load https://ap1.salesforce.com/soap/wsdl.jsp. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin MyLocalHost is therefore not allowed access.

Could you suggest me how can I solve this issue?


  • Sounds like you need to deal with the CORS request to the Salesforce resource, I would start here html5rocks.com/en/tutorials/cors.
    – kcshafer
    Commented Sep 8, 2014 at 13:58
  • I read this topic and issue is that I can't manage salesforce server side. All I have is client-side application.
    – Dusha
    Commented Sep 9, 2014 at 7:00

1 Answer 1


Ideas: Support of CORS (Cross-Origin Resource Sharing) in RESTful API.

Coming in the next release

That said, the resource you are requesting isn't something I would typically associate with a REST request. You might need to specify the sid cookie with the accessToken (sessionId) to request the Partner API WSDL. One option here would be to create your own RESTful web service in Apex that does the required HttpRequest for the WSDL.

Something else to note. The Partner WSDL is static within a release. There is nothing stopping you taking a copy and storing it somewhere accessible.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .