在javascript中调用soap xml时显示未定义的错误

时间:2014-12-12 15:28:33

标签: jquery xml soap

我正在开发一个需要调用soap xml的应用程序,它显示数据而不使用jquery传递任何参数,但我继续得到错误' 这是我的代码

    <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script>
$.support.cors = true;
    $(document).ready(function () {

            $("#btnh").click(function (event) {
                var webserUrl = 'http://localhost/googlesearch/service1.asmx?op=SearchString';

                var soapRequest = '<?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> \
<SearchString xmlns="http://tempuri.org/" /> \
</soap:Body> \
 </soap:Envelope>';
                alert(soapRequest);
                soapRequest = $.trim(soapRequest);
                alert(soapRequest);
                $.ajax({
                    type: "POST",
                    url: webserUrl,
                    contentType: "text/xml; charset=\"utf-8\"",
                    dataType: "xml",
                    processData: false,
                    data: soapRequest,
                    success: function (data, status, req) {
                    if (status == "success")
                        alert(req.responseText);
                },
                error: function (data, status, req) {

                    alert(req.responseText + " " + status);
                }
                });
            });
        });
    </script>

注意:在检查浏览器控制台时,它会显示&#34;找不到方法&#34;

0 个答案:

没有答案