I found a similar post here but I am still not able to get to the solution to fix the issue I am facing.
Here's the jquery snippet of my soap request.
<script type="text/javascript">
var invocation;
$(document).ready(function () {
invocation = new XMLHttpRequest();
var webserUrl = "https://sc.quikstor.com/eComm3ServiceSS/QuikStorWebServiceSS.asmx/SmartPhone_Download_TenantInformation";
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>' +
' <SmartPhone_Download_TenantInformation xmlns="http://tempuri.org/">' +
'<csUser>someuser</csUser>' +
'<csPassword>userpassword</csPassword>' +
'<csSiteName>someString</csSiteName>' +
'<sSearchBy>someString</sSearchBy>' +
'</SmartPhone_Download_TenantInformation>' +
'</soap:Body>' +
'</soap:Envelope>';
if (invocation) {
invocation.open('POST', webserUrl, true);
invocation.setRequestHeader('X-PINGOTHER', 'GetTenant');
invocation.setRequestHeader('Content-Type', 'text/xml');
invocation.onreadystatechange = function (data) { handleStateChange(data) };
invocation.send(soapRequest);
}
});
function handleStateChange(data) {
switch (invocation.readyState) {
case 0: // UNINITIALIZED
case 1: // LOADING
case 2: // LOADED
case 3: // INTERACTIVE
break;
case 4: // COMPLETED
//alert(data);
break;
default: alert("error");
}
}
</script>
It gives me following error on console:
XMLHttpRequest cannot load https://sc.quikstor.com/eComm3ServiceSS/QuikStorWebServiceSS.asmx/?op=SmartPhone_Download_TenantInformation. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:50099' is therefore not allowed access.
I have defined the header in soapRequest but it still gives me this error. I can't find a solution to this. Any suggestions??