title: how to parse the following soap response with javascript? (Can't use jquery)
body: <p>give the following SOAP response:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soapenv:Body&gt;
        &lt;ns3:signOnResponse xmlns:ns3="http://www.verimatrix.com/omi"&gt;
           &lt;sessionHandle&gt;
              &lt;ns1:handle xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;h0PtwMXVmHp6Oqy7A6CmcrFrnVM=&lt;/ns1:handle&gt;
           &lt;/sessionHandle&gt;
           &lt;result&gt;
              &lt;ns1:resultId xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;admin&lt;/ns1:resultId&gt;
              &lt;ns1:resultCode xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;0&lt;/ns1:resultCode&gt;
              &lt;ns1:resultText xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;Success&lt;/ns1:resultText&gt;
           &lt;/result&gt;
        &lt;/ns3:signOnResponse&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>How can I obtain the handle :h0PtwMXVmHp6Oqy7A6CmcrFrnVM= located at ns1:handle?</p>
  
  <p>My code is the following:</p>
  
  <pre><code>responseXml = responseXml.replace(/^&lt;\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?&gt;/, "");
  var response = new XML(responseXml);
  
  // Determine the namespace of the SOAP Envelope:
  //
  var soap = response.namespace();
  
  // Specify the namespace of the verify email response:
  //
  var ws = response.*.*.namespace();
  
  // Set this namespace as a default to make parsing the response easier:
  
  default xml namespace = ws
  
  var responseBody = response.soap::Body.signOnResponse;
  var handle = responseBody.signOnResponse.sessionHandle.handle
  
  Alert(handle);
  </code></pre>
  
  <p>The problem is that it returns a null value...</p>
  
  <p>When I do Alert(responseBody.toXMLString());</p>
  
  <p>I get:</p>
  
  <pre><code>&lt;ns3:signOnResponse xmlns:ns3="http://www.verimatrix.com/omi" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;sessionHandle&gt;
      &lt;ns1:handle xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;TBdn27dfFPlpWG/HTRgH16LsrkI=&lt;/ns1:handle&gt;
    &lt;/sessionHandle&gt;
    &lt;result&gt;
      &lt;ns1:resultId xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;admin&lt;/ns1:resultId&gt;
      &lt;ns1:resultCode xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;0&lt;/ns1:resultCode&gt;
      &lt;ns1:resultText xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd"&gt;Success&lt;/ns1:resultText&gt;
    &lt;/result&gt;
  &lt;/ns3:signOnResponse&gt;
  </code></pre>
  
  <p>I'm using Pentaho Data Integration and parsing the response with javascript step.</p>
  
  <p>Thank you</p>