jQuery SOAP返回404但在SoapUI中工作正常

时间:2014-10-09 14:59:13

标签: jquery ajax wcf soap http-status-code-404

下面代码中的URL和Soap信封在SoapUI中工作正常,但是当我用jQuery尝试相同的请求时,我得到了404 Not Found meaasage。这段代码有什么问题吗? :

  $(document).ready(function () {        

        $("#btnCallWebService").click(function () {               

            var sr = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:swp="http://soquij.qc.ca/swPlumProv" xmlns:swp1="http://schemas.datacontract.org/2004/07/swPlumProv">' +
               '<soapenv:Header/>' +
               '<soapenv:Body>' +
                 ' <swp:Recherche>' +
                     '<swp:Dossier>?</swp:Dossier>' +
                     '<swp:Utilisateur>?</swp:Utilisateur>' +
                     '<swp:User>XXXX</swp:User>' +
                     '<swp:Pass>XXXX</swp:Pass>' +
                     '<swp:Recherche>' +
                        '<swp1:AnneeDebut>?</swp1:AnneeDebut>' +
                        '<swp1:AnneeFin>?</swp1:AnneeFin>' +
                        '<swp1:Nom>Bourgeois</swp1:Nom>' +
                        '<swp1:Prenom>Pierre</swp1:Prenom>' +
                        '<swp1:Type>Penal</swp1:Type>' +
                     '</swp:Recherche>' +
                  '</swp:Recherche>' +
                '</soapenv:Body>' +
            '</soapenv:Envelope>';                  

            $.ajax({
                type: "POST",
                url: "https://soquij.qc.ca/swPlumProv/swPlumProv.svc?wsdl",
                data: sr,
                contentType: "text/xml; charset=\"utf-8\"",
                dataType: "xml",
                success: function (data) {
                    $("#response").text("YES!! :-)" + data );                       
                },
                error: function (msg) {
                    $("#response").text("Erreur: " + msg.status + ": " + msg.statusText)       
                }
            });
        });
    });

谢谢。

0 个答案:

没有答案