If you can't add a cross-domain file in the target server, there's not much
you can do from the swf side.

You can, however, use some server side logic to make a "bridge" between your
swf and the JSP page. You can have the swf connect to some server-side
script (hosted locally or in some server where you can add a crossdomain
policy file) that will actually connect to the target JSP and return the
results.

I've done this in php and in .NET, and I'm sure you can do it with a JSP, if
that's what you have available in your server.

In php, it could be as easy as:

$jsp_return = file_get_contents("
http://target_domain/some.jsp?someVar=someValue";);
echo $jsp_return;

If you have fopen wrappers enabled in you php config (if you don't,
file_get_contents will fail when it finds http:// in the begining of the
file name) .

If you need more control and you're using php, you can use the cUrl
functions.

Hope it helps.


Cheers
Juan Pablo Califano

2008/8/18, sebastian <[EMAIL PROTECTED]>:
>
> Question in Flash 7, AS2:
>
> Trying to figure out if there is any solution to how to send data to a JSP
> page that is not located on the same server as my SWF file.
>
> Since I don't have access to the server hosting the JSP page I can't add a
> cross-domain XML file to that machine.
>
> In the SWF file I can access the JSP page fine if I run the SWF file
> locally, but as soon as I put it on a test web server I get 'connection
> failed' instead.
>
> At the top of the SWF file I have included:
>
> System.security.allowDomain("http://name.ofJSPdomain.com<http://name.ofjspdomain.com/>
> ");
> System.security.allowInsecureDomain("http://name.ofJSPdomain.com<http://name.ofjspdomain.com/>
> ");
>
> and I also tried it with "*" instead to no avail.
>
> I'm using code like this:
>
> var send_lv:LoadVars = new LoadVars();
> send_lv.loginName = "somename";
> send_lv.loginPassword = "somepassword";
>
> var result_lv:LoadVars = new LoadVars();
>
> result_lv.onLoad = function(success) {
>  if (success) {
>  result_ta.text = "load working?";
>  } else {
>  result_ta.text = "Error connecting to server.";
>  }
> };
>        
> send_lv.sendAndLoad("http://name,ofJSPdomain/locationtofile/nameoffile.jsp";,
> result_lv, "POST");
>
> I'm using sendAndLoad but honestly I only need to send data, not receive
> it.
>
> Can anyone help? I've been stuck now for over 2 hours spinning after my
> tail...
> :(
>
> Thanks!
>
> Seb.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to