ajax & ssl certs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tman2
    New Member
    • Mar 2010
    • 1

    ajax & ssl certs

    Hi, fairly new to javascript.

    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 ?

    Code:
    url2="https://myServer/axis2/webService/...";		
    envelope2 =
    		'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">' +
    		   '<soap:Header/>' +
    		   '<soap:Body>' +
                            .....
    		   '</soap:Body>' +
    		'</soap:Envelope>';
    ... then
    Code:
    		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
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I recommend a google search …

    some example SOAP
    Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
      <SOAP-SEC:Signature
         xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12"
         SOAP-ENV:actor="http://www.example.com/soapEndpoint"
         SOAP-ENV:mustUnderstand="1">
       <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <ds:SignedInfo>
             <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
             <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
             <ds:Reference URI="#Body">
                <ds:Transforms>
                   <ds:Transform Algorithm="http://www.w3.org/TR/2000/CR-xml-c14n-20001026"/>
                </ds:Transforms>
                <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                <ds:DigestValue>zA9itX3gfzCeYIYyalslJezGwAg=</ds:DigestValue>
                </ds:Reference>
             </ds:SignedInfo>
             <ds:SignatureValue>
                MCpXybqBI2Aa3Yx4IovjN3GgchaMDB3lIF1M6a9+Ngi59MqDwK3LRQ==
             </ds:SignatureValue>
          </ds:Signature>
       </SOAP-SEC:Signature>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body">
      <ns1:add xmlns:ns1="urn:NumberAdder" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <number1 xsi:type="xsd:int">1</number1>
         <number2 xsi:type="xsd:int">2</number2>
      </ns1:add>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Comment

    Working...