jquery / ajax / soap - access-control-allow-origin
I'm trying to access a SOAP web service using jquery / ajax and getting an access control allow origin error:
XMLHttpRequest cannot load https://site.com/service/Service.asmx?op=LoginConsumer. Origin http://localhost:8888 is not allowed by Access-Control-Allow-Origin
Is there a way around this? Are their certain things I need to do to set this up? I've been told that开发者_如何学编程 there are no access controls in place yet. I'm testing from a local server (localhost).
I'm following this tutorial:
http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/
Try creating a fetchSoap.php
page on localhost
that fetches the data from site.com
and simply echos it. Then you can fetch the data from localhost/fetchSoap.php
and you will not be violating same origin policies.
The PHP code would be (you can use any language you're currently using)
http://localhost/FetchSOAP.php
<?php
die( file_get_contents( 'http://site.com/PathToSoap/' ) );
?>
You seem to be violating the same origin policy restriction. You cannot send AJAX requests to different domains.
精彩评论