Expand my Community achievements bar.

security error accessing url

Avatar

Former Community Member
I'm using flex builder to create a small flex project to
learn how to

call web service in flex,but I encountered a problem really
confusing

me.I created a new file called wstest.mxml and here's its
content:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"


layout="vertical">

<mx:Script>

<![CDATA[

import mx.controls.Alert;

import mx.rpc.Fault;

import mx.rpc.events.FaultEvent;



private function onFault(event :

FaultEvent) : void

{

var f : Fault = event.fault;

Alert.show

(f.faultString,"Error");

}



private function list() : void

{

adminService.getWeather.send();

}

]]>

</mx:Script>

<mx:WebService id="adminService" service="Weather"

port="WeatherSoap"

wsdl="
http://www.wopos.com/webservice/weather.asmx?

wsdl" showBusyCursor="true"

fault="onFault(event)">

<mx:operation name="getWeather">

<mx:request>

<mCity>

ÉϺ£

</mCity>

</mx:request>

</mx:operation>

</mx:WebService>

<mx:Label id="lbl"

text="{adminService.getWeather.lastResult}"/>

<mx:Button label="Call Web Service" click="list()"/>

</mx:Application>

After building finished,I ran the generated wstest.swf in the


directory called bin,the output directory of the flex

project,everything is ok.But when I put the swf file in
another

position, say, c:/. Then when I ran the swf file an error
message was

returned saying 'Security error accessing url'. I can't
understand

why this happened. It seems the swf file can only run under
the bin

directory. Any one can help? Thanks!

2 Replies

Avatar

Level 1
I have 2 projects stored in the SAME file system location,
SAME project/folder structure and calling the SAME webapp/webpage.
One of them works, the other gets "Security error accessing url".



I even copied the entire mxml page content from the working
project to the none-working, and vise versa. That one project just
keeps giving that error.



Is there a project property I need to set?



I don't have crossdomain.xml in my webapp, but not sure that
I need it because clearly one of the project run fine without it.



Thanks.

Avatar

Level 1
I hope, you should keep useProxy="false" in WebService tag.
it might works for you.