是否有可能使用jquery获得跨域SOAP请求 [英] is it possible to get cross domain SOAP request using jquery

查看:209
本文介绍了是否有可能使用jquery获得跨域SOAP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaScript来获得肥皂剧响应 但是经过很多痛苦,我意识到无法获得跨域xml http请求. 所以我决定继续使用jquery 现在我不需要代码了 我只需要一些提示和确认,如果可能的话在jQuery中 下面是我的js的代码 var getmarket = new XMLHttpRequest(); getmarket.open('POST','http://www.betfair.com/publicapi/',true);

i am using a javascript to get a soap response but after a lot of pain i realized that it is not possible to get cross domain xml http request. so i decided to move on to jquery now i dont need a code to that i just need some tips and confirmation if possible in jquery below is code for my js var getmarket = new XMLHttpRequest(); getmarket.open('POST', 'http://www.betfair.com/publicapi/', true);

    var m_request = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" '+
                    'xmlns:bfex="http://www.betfair.com/publicapi/v5/BFExchangeService/" '+
                    'xmlns:v5="http://www.betfair.com/publicapi/types/exchange/v5/">'+
                    ' <soapenv:Header/>'+
                    '<soapenv:Body>'+
                    '<bfex:getAllMarkets>'+
                    '<bfex:request>'+
                    '<header>'+
                       '<clientStamp>0</clientStamp>'+
                       '<sessionToken>Y9eTuEvlrTM55pbRB1kIj0As0bVvz3eFm+p1FY+svHk=</sessionToken>'+
                    '</header>'+
                    '<locale>en</locale>'+
                    '<eventTypeIds>'+
                       '<v5:int>1</v5:int>'+
                    '</eventTypeIds>'+
                    '<countries>'+
                       '<v5:Country>GBR</v5:Country>'+
                    '</countries>'+
                    '<fromDate>2012-08-23TO00:00:00.000Z</fromDate>'+
                    '<toDate>2012-08-24TO00:00:00.000Z</toDate>'+
                 '</bfex:request>'+
              '</bfex:getAllMarkets>'+
           '</soapenv:Body>'+
        '</soapenv:Envelope>';

    getmarket.onreadystatechange = function (){
        if (getmarket.readyState == 4 && getmarket.status == 200)
        document.write(getmarket.responseText);
        }

    getmarket.setRequestHeader('Content-Type', 'text/xml');
    getmarket.send(m_request);
    document.write(getmarket.responseText);

推荐答案

JQuery是Javascript的包装器.如果JavaScript无法执行,则JQuery也不会执行.您将必须让服务器进行查找.

JQuery is a wrapper around Javascript. If javascript won't do it JQuery wont either. You will have to get your server to do the lookup.

这篇关于是否有可能使用jquery获得跨域SOAP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆