0

I need to send a soap requests to an external website but keep on getting “Failed to load resource: Origin xxx is not allowed by Access-Control-Allow-Origin” and “XMLHttpRequest cannot load https://...?wsdl. Origin xxx is not allowed by Access-Control-Allow-Origin.

I have no control over the responding server.

Is there a way to send the request without the browser preflighting the request? Another way of sending soap requests?

I am using EE 2.9.3 and JQuerySoap

<script>
$( document ).ready(function() {
var $_POST = <?php echo json_encode($_POST); ?>;
var $entry_date = $_POST["entry_date"];
var $billingFirstName = $_POST["billingFirstName"];
var $billingLastName = $_POST["billingLastName"];
var $eMail = $_POST["eMail"];
var $special = $_POST["special"];
var $howoften = $_POST["howoften"];
var $billingaddress = $_POST["billingaddress"];
var $billingaddress2 = $_POST["billingaddress2"];
var $billingzipcode = $_POST["billingzipcode"];
var $billingcity = $_POST["billingcity"];
var $doorcode = $_POST["doorcode"];
var $instructions = $_POST["instructions"];
var $telephone = $_POST["telephone"];
var $produktnamn = $_POST["produktnamn"];
var $produktpris = $_POST["produktpris"];
var $dibsrefno = $_POST["dibsrefno"];
var $billingdate = $_POST["billingdate"];


var xml =
    ['<soap:Envelope xmlns:soap="http://xxx" xmlns:v2="https://xxx">',
        '<soap:Header/>',
            '<soap:Body>',
                  '<v2:subscribeAndSettle>',
                     '<v2:shopName>xxx</v2:shopName>',
                     '<v2:userName>xxx</v2:userName>',
                     '<v2:password>xxx</v2:password>',
                     '<v2:verifyID>'+$dibsrefno+'</v2:verifyID>',
                     '<v2:data>1:'+$produktnamn+':1:'+$produktpris+'00:</v2:data>',
                     '<v2:ip>xxx</v2:ip>',
                     '<v2:currency>SEK</v2:currency>',
                     '<v2:extra>&amp;entry_date='+$entry_date+'&amp;billingFirstName='+$billingFirstName+'&amp;billingLastName='+$billingLastName+'&amp;eMail='+$eMail+'&amp;special='+$special+'&amp;howoften='+$howoften+'&amp;billingaddress='+$billingaddress+'&amp;billingaddress2='+$billingaddress2+'&amp;billingcity='+$billingcity+'&amp;doorcode='+$doorcode+'&amp;instructions='+$instructions+'&amp;billingdate='+$billingdate+'</v2:extra>',
                  '</v2:subscribeAndSettle>',
               '</soap:Body>',
    '</soap:Envelope>'];
$.soap({
    url: 'https://xxx?wsdl',
    data: xml.join(''),
});



});
</script>
0

I was never able to solve this, instead i moved the javascript into a custom module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.