I was stuck on below the 'soapRequest', I try to test my netbeans connect cross domain access but keep on failing, anyone can help me point out my mistake?
Add on, I installed 'Allow-Control-Allow-Origin' on my google chrome browser and also tried to browser poster plugin to test the 'get' and 'post' are work.
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 ");
}
});
}
Below is the error message Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/. (15:39:52:688 | warning, deprecation) at public_html/js/jquery-1.11.3.min.js:5
Failed to load resource: the server responded with a status of 400 (Bad Request) (15:39:58:281 | error, network) at http://localhost:5566/Test.svc
XMLHttpRequest cannot load http://localhost:5566/Test.svc. Invalid HTTP status code 400 (15:39:58:282 | error, javascript) at public_html/index.html