Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用CORS在Soap请求中包含头_Jquery_Xml_Soap - Fatal编程技术网

Jquery 使用CORS在Soap请求中包含头

Jquery 使用CORS在Soap请求中包含头,jquery,xml,soap,Jquery,Xml,Soap,我找到了一个类似的帖子,但我仍然无法找到解决我所面临问题的方法 下面是我的soap请求的jquery片段 <script type="text/javascript"> var invocation; $(document).ready(function () { invocation = new XMLHttpRequest(); var webserUrl = "https://sc.quikstor.com/eComm3Ser

我找到了一个类似的帖子,但我仍然无法找到解决我所面临问题的方法

下面是我的soap请求的jquery片段

<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>

我已经在soapRequest中定义了头,但它仍然给我这个错误。我找不到解决这个问题的办法。有什么建议吗???

jQuery在哪里?顺便说一句,如果您联系的服务器不允许跨源资源共享,那么您的客户端脚本中没有可以解决此问题的头。我联系的服务器允许跨源资源共享。我正在使用CORS将soap请求发送到所需的服务。我对soap请求和CORS非常陌生。我需要从这里使用一些web服务。我有使用那里的web服务所需的凭据。好吧,很明显,你是被同一来源的策略所吸引,当我访问你的代码中似乎有错误的url时,我猜它是,没有CORS头存在。
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.