0
 var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("POST", "http://service.project-development-site.de/soap.php",true);
    xmlhttp.onreadystatechange=function() {
     if (xmlhttp.readyState == 4) {

    alert(xmlhttp.responseText);

      // http://www.terracoder.com convert XML to JSON 
      var json = XMLObjectifier.xmlToJSON(xmlhttp.responseXML);
      var result = json.Body[0].GetQuoteResponse[0].GetQuoteResult[0].Text;
      // Result text is escaped XML string, convert string to XML object then convert to JSON object
      json = XMLObjectifier.xmlToJSON(XMLObjectifier.textToXML(result));
      alert(symbol + ' Stock Quote: $' + json.Stock[0].Last[0].Text); 
     }
    }
    xmlhttp.setRequestHeader("SOAPAction", "http://service.project-development-site.de/soap.php");
    xmlhttp.setRequestHeader("Content-Type", "text/xml");
    var xml = '<?xml version="1.0" encoding="utf-8"?>' +
     '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">' + 
        '<soapenv:Header/>'+
           '<soapenv:Body>'+
              '<tem:loginUserSoapInPart>'+
                 '<tem:userName>user</tem:userName>'+
                 '<tem:passWord>pwd</tem:passWord>'+
                 '<tem:accesToken>acktoken</tem:accesToken>'+
              '</tem:loginUserSoapInPart>'+
           '</soapenv:Body>'+
        '</soapenv:Envelope>';
    xmlhttp.send(xml);

我已经将此代码与肥皂请求 xml 一起使用,但它没有给我响应。我在警报中检查它,但我收到空警报消息。

4

0 回答 0