Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to get cross domain SOAP request using jquery

Tags:

jquery

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);
like image 251
user1511443 Avatar asked Oct 07 '22 20:10

user1511443


2 Answers

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.

like image 80
Anthony Palmer Avatar answered Oct 14 '22 16:10

Anthony Palmer


You can't do this, only JSONP is allowed cross-domain.

also check this : Cross-domain SOAP from the browser

like image 26
Pranay Rana Avatar answered Oct 14 '22 16:10

Pranay Rana