Ajax-SOAP跨域&x2018;邮政’;错误请求400

Ajax-SOAP跨域&x2018;邮政’;错误请求400,ajax,soap,xmlhttprequest,webservice-client,bad-request,Ajax,Soap,Xmlhttprequest,Webservice Client,Bad Request,我被困在“soapRequest”下面,我试图测试我的netbeans连接跨域访问,但一直失败,有人能帮我指出我的错误吗 另外,我在我的google chrome浏览器上安装了“Allow-Control-Allow-Origin”,并尝试使用浏览器海报插件来测试“get”和“post”是否有效 function submitLogIn(username, passw) { var userId = document.getElementById(username).value;

我被困在“soapRequest”下面,我试图测试我的netbeans连接跨域访问,但一直失败,有人能帮我指出我的错误吗

另外,我在我的google chrome浏览器上安装了“Allow-Control-Allow-Origin”,并尝试使用浏览器海报插件来测试“get”和“post”是否有效

function submitLogIn(username, passw) {
    var userId = document.getElementById(username).value;
    var userPass = document.getElementById(passw).value;

    var soap1 = '<soap:Envelope ';
    var soap2 = 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
    var soap3 = 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ';
    var soap4 = 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ';
    var soap5 = '<soap:Body> ';
    var soap6 = '<Login xmlns="S2Ed"> ';
    var soap7 = '<userid>' + userId + '</userid> ';
    var soap8 = '<password>' + userPass + '</password> ';
    var soap9 = '</Login>';
    var soap10 = '</soap:Body>';
    var soap11 = '</soap:Envelope>';
    var soapMessage = soap1 + soap2 + soap3 + soap4 + soap5 + soap6 + soap7 + soap8 + soap9 + soap10 + soap11;

    // Call + ing...... 
    CallAjax(soapMessage);
}

function CallAjax(soapMessage) {
    console.log(soapMessage.toString());

    $.support.cors = true;
    $.ajax({
        type: 'POST',
        url: http://localhost:5566/Test.svc,
        // contentType: 'application/soap+xml',
        // content-Type: 'text/plain',
        contentType: 'text/xml; charset=utf-8',
        async: true, 
        dataType: 'xml',
        crossDomain: true,
        // processData: false,
        headers: {
            SOAPAction: 'S2Ed/App/Login'
        },
        data: soapMessage,
        success: function (soapResponse) {
            console.log(soapResponse);
            console.log(soapResponse.toString());
            console.log(soapResponse.toJSON());
            console.log(soapResponse.toXML());
        },
        error: function (soapResponse) {
            alert("Failed SOAP ");
        }
    });
}
函数submitLogIn(用户名、密码){
var userId=document.getElementById(username).value;
var userPass=document.getElementById(passw).value;
var soap1=“”;
var soap5='';
var soap6=“”;
var soap7=''+userId+'';
var soap8=''+userPass+'';
var soap9='';
var-soap10='';
var-soap11='';
var soapMessage=soap1+soap2+soap3+soap4+soap5+soap6+soap7+soap8+soap9+soap10+soap11;
//呼叫+ing。。。。。。
CallAjax(soapMessage);
}
函数CallAjax(soapMessage){
log(soapMessage.toString());
$.support.cors=true;
$.ajax({
键入:“POST”,
网址:http://localhost:5566/Test.svc,
//contentType:“应用程序/soap+xml”,
//内容类型:“文本/普通”,
contentType:'text/xml;字符集=utf-8',
async:true,
数据类型:“xml”,
跨域:是的,
//processData:false,
标题:{
SOAPAction:'S2Ed/App/Login'
},
数据:soapMessage,
成功:函数(soapResponse){
log(soapResponse);
log(soapResponse.toString());
log(soapResponse.toJSON());
log(soapResponse.toXML());
},
错误:函数(soapResponse){
警报(“失败的SOAP”);
}
});
}
下面是错误消息 主线程上的同步XMLHttpRequest不推荐使用,因为它会对最终用户的体验产生有害影响。如需更多帮助,请查看。(15:39:52:688 |警告、反对) 在public_html/js/jquery-1.11.3.min.js:5

加载资源失败:服务器响应状态为400(错误请求)(15:39:58:281 |错误,网络) 在

无法加载XMLHttpRequest。无效的HTTP状态代码400(15:39:58:282 |错误,javascript)
在public_html/index.html上,错误400通常表示您向服务器提交了服务器不喜欢的内容。即在年龄字段中提交姓名等

另外,您的请求xml可能是错误的。您能在控制台中打印它并查看它是否是有效的xml吗