开发者

Webservice Call HTTPS

开发者 https://www.devze.com 2023-03-26 08:18 出处:网络
I am trying to make an https call to a web-service using XMLHttpRequest object in javascript. i successfully made a regular http call but having trouble getting the https working. The https call requi

I am trying to make an https call to a web-service using XMLHttpRequest object in javascript. i successfully made a regular http call but having trouble getting the https working. The https call requires an ssl cert so any ideas how to attach the cert for this call ?

    url2="https://myServer/axis2/webService/..开发者_StackOverflow社区.";        
envelope2 =
        '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">' +
           '<soap:Header/>' +
           '<soap:Body>' +
                        .....
           '</soap:Body>' +
        '</soap:Envelope>';

.. then

 xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-Type", "application/soap+xml;charset=UTF-8;action=\"urn:getProjectInfo\"");
    xmlHttp.setRequestHeader("Content-Length", len);
    xmlHttp.setRequestHeader("SOAPAction", "urn:getProjectInfo");

the problem is how to handle the ssl keystore to make the call ... thanks for any help/insight


You don't attach a cert for the call. You have to install the SSL cert on the server this is running on. If the SSL cert is installed, then the call will work simply by making it HTTPS.

Like Pekka referred to, you will run into a same-origin-policy issue if the page you are making the request from is not the exact same domain: in this case "https://myserver/" (capitalization is not important).

0

精彩评论

暂无评论...
验证码 换一张
取 消