如何进行ajax调用来解析xml架构

时间:2015-07-06 20:10:57

标签: javascript jquery ajax xml xml-parsing

我需要使用客户端的ajax调用来解析(xml架构)。以下是该功能。让我知道我做错了什么。感谢。

$.ajax({
        url: webServiceURL, 
        type: "POST",
        dataType: "xml", 
        data: soapMessage, 
        contentType: "text/xml; charset=\"utf-8\"",
        complete: OnSuccess            
    });

function OnSuccess(xmlHttpRequest, status)
{
    $(xmlHttpRequest.responseXML)
    .find('Result')
    .each(function()
    {
        return $(this).find('xsd\\:schema').text();
    });
}

这是我的SOAP响应的架构/定义

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Response xmlns="Auto Services">
      <Result>
        <xsd:schema>schema</xsd:schema>xml</Result>
    </Response>
  </soap:Body>
</soap:Envelope>

0 个答案:

没有答案