tags:

views:

378

answers:

2

I am trying to get data from my server, used RemoteObject to accomplish it. When I run the application on my localhost it works great but when iam using it on my server i get a Channel.Security.Error(Security Error accessing URL).

On the server side logs there is a mention about cross domain . 77.127.194.4 - - [23/Oct/2008 21:15:11] "GET /crossdomain.xml HTTP/1.1" 501

Any one encountered the same problem ? any idea ?

+1  A: 

Have you tried to add to your crossdomain.xml (where your fetching the stuff from) this:

<?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/xml/dtds/cross-domain-policy.dtd"&gt;
    <cross-domain-policy>
        <site-control permitted-cross-domain-policies="all"/>
        <allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
        <allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
    </cross-domain-policy>

The stuff in capslock you'll probably have to change to fit your framework. For example i copied that from the one i use with macromedia flash. Instead of "www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/..." i normaly have "www.macromedia.com/xml/dtds/...

I'm not sure but try to investigate that, it's probably your problem. For cross-domain, you normaly need to add to the server side, where your fecthing stuff from, permission for other sites to get it.

fmsf
+1  A: 

I have found the solution. You are right about crossdomain.xml file, but unfortunately, the Python SimpleXMLRPCServer library does not support the GET method by default, so we need to implement this.

from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler

class ExtendedXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
  def do_GET(self):
    #only allow a request for the crossdomain file
    if self.path != '/crossdomain.xml':
      self.send_response(403)
      self.log_request(403)
      return

    #open the crossdomain file and read its contents
    response = open('crossdomain.xml', 'r').read()

    #write the data to the socket along with valid HTTP headers
    self.send_response(200)
    self.send_header("Content-type", "text/xml")
    self.send_header("Content-length", str(len(response)))
    self.end_headers()
    self.wfile.write(response)
    self.log_request(200)