acabei de achar o pq de estar dando erro, embora nao veja logica nisso.... qndo eu rodo o codigo no flex builder 3, funciona
se eu ridar no myeclipse 7.1 com o plugin do flex completo, ele dah esse erro de segurança... tem alguma logica do pq disso?? 2009/5/28 Bruno Ricciardi <[email protected]> > Qndo eu coloco exatamente esse codigo pra rodar me aparece uma mensagem > dizendo : > > "Security error accessing url" > > gente foi crtl+c + ctrl+v.... > > como pode dar diferença no resultado??? > > > <?xml version="1.0"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > creationComplete="onCreationComplete()"> > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > import mx.rpc.soap.mxml.WebService; > private var ws:mx.rpc.soap.mxml.WebService; > private var getMyInfoRequest:String = "22710325"; > public function onCreationComplete():void > { > ws = new mx.rpc.soap.mxml.WebService(); > //ws.endpointURI = "http://myserver.com/myService.php"; // > comentada pois o URI está errado e não é necessário > ws.loadWSDL(" > http://www.bronzebusiness.com.br/webservices/wscep.asmx?wsdl"); > ws.addEventListener(FaultEvent.FAULT, faultHandler); > ws.addEventListener(ResultEvent.RESULT, > resultHandler); > } > public function resultHandler(event:ResultEvent):void > { > var resposta:Object = event.result.Tables.tbCEP.Rows[0]; // > pega a resposta do CEP corretamente. > Alert.show(resposta.logradouro+" "+resposta.nome+" - > "+resposta.bairro+"\r"+resposta.cidade+", "+resposta.UF); > } > public function faultHandler(event:FaultEvent):void > { > Alert.show(event.fault.faultString); > } > public function runRequest():void > { > ws.cep(getMyInfoRequest); > } > ]]> > </mx:Script> > <mx:Button label="RunRequest" click="runRequest()"/> > </mx:Application> > > 2009/5/27 Júniorp <[email protected]> > > >> Obrigado Julio, agora funionou perfeitamente não sei o porque o teste >> que fiz anteriormente de problema. >> >> Abraços. >> >> ==================================== >> Ednei Parmigiani Júnior >> Araçatuba - SP >> E-mail/MSN: [email protected] >> ==================================== >> >> On 27 maio, 12:32, Julio Carneiro <[email protected]> wrote: >> > Ednei, >> > >> > Eu usei o mesmo código do Bruno com um único ajuste, comentar a linha >> > em que ele estava setando o endpointURI: >> > // ws.endpointURI = "http://myserver.com/myService.php"; >> > >> > Este não é o endPoint daquele serviço do CEP. Fiz só um outro ajuste >> > no tratamento do resultado pois o código original não trava >> > corretamente a resposta do CEP. >> > >> > De qualquer maneira aí vai: >> > >> > <?xml version="1.0"?> >> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> > creationComplete="onCreationComplete()"> >> > <mx:Script> >> > <![CDATA[ >> > import mx.controls.Alert; >> > import mx.rpc.events.ResultEvent; >> > import mx.rpc.events.FaultEvent; >> > import mx.rpc.soap.mxml.WebService; >> > private var ws:mx.rpc.soap.mxml.WebService; >> > private var getMyInfoRequest:String = "22710325"; >> > public function onCreationComplete():void >> > { >> > ws = new mx.rpc.soap.mxml.WebService(); >> > //ws.endpointURI = "http://myserver.com/ >> > myService.php"; // comentada pois o URI está errado e não é necessário >> > ws.loadWSDL("http://www.bronzebusiness.com.br/ >> > webservices/wscep.asmx?wsdl"); >> > ws.addEventListener(FaultEvent.FAULT, faultHandler); >> > ws.addEventListener(ResultEvent.RESULT, >> > resultHandler); >> > } >> > public function resultHandler(event:ResultEvent):void >> > { >> > var resposta:Object = event.result.Tables.tbCEP.Rows >> > [0]; // pega a resposta do CEP corretamente. >> > Alert.show(resposta.logradouro+" "+resposta.nome+" - >> > "+resposta.bairro+"\r"+resposta.cidade+", "+resposta.UF); >> > } >> > public function faultHandler(event:FaultEvent):void >> > { >> > Alert.show(event.fault.faultString); >> > } >> > public function runRequest():void >> > { >> > ws.cep(getMyInfoRequest); >> > } >> > ]]> >> > </mx:Script> >> > <mx:Button label="RunRequest" click="runRequest()"/> >> > </mx:Application> >> > >> > On May 27, 8:17 am, Júniorp <[email protected]> wrote: >> > >> > >> > >> > > Caro Julio Carneiro, teria como vc postar aqui sua app que tu consumiu >> > > o WS que consultou CEP >> > > com sucesso, compartilhe conosco, pois tentei com o código do Bruno e >> > > não consegui. >> > >> > > abraços >> > >> > > ==================================== >> > > Ednei Parmigiani Júnior >> > > Araçatuba - SP >> > > E-mail/MSN: [email protected] >> > > ==================================== >> > >> > > On 26 maio, 18:05, Julio Carneiro <[email protected]> wrote: >> > >> > > > Bruno, >> > >> > > > Veja minhas respostas... nada a ver com crossdomain, a não ser que >> vc >> > > > rode a aplicação a partir de um servidor. Rodando local a partir do >> > > > Flex builder (file:///...) não tem problema de crossdomain. >> > >> > > > EU consigo consultar CEP daqui sem problemas, usando teu código com >> > > > minhas correções >> > >> > > > [] >> > > > julio >> > >> > > > On May 26, 5:46 pm, Bruno <[email protected]> wrote: >> > >> > > > > Gente, vcs nao vao acreditar, mas o problema esta no cross domain. >> > >> > > > > a questao eh que estou testando com webservices que sao publicos, >> ou >> > > > > seja, nao tem como eu disponibilizar o arquivo de crossdomain >> dentro >> > > > > do servidor do WS... >> > >> > > > > tem alguma saida local que resolva isso?? minha aplicaçao nao esta >> > > > > sobre nenhum servidor de aplicacao, somente local... >> > >> > > > > On 26 maio, 16:01, Júniorp <[email protected]> wrote: >> > >> > > > > > Caro Bruno. >> > > > > > Entre no link abaixo, baixe e instale a aplicações Tour de Flex >> > > > > > component explorer (TourDeFlex.air), nesta aplicação >> > > > > > tem vários exemplos e aplicações em flex, inclusive consumo de >> WS. >> > >> > > > > > Link:http://www.adobe.com/devnet/flex/tourdeflex/ >> > >> > > > > > Bons estudos, Abraços >> > >> > > > > > ==================================== >> > > > > > Ednei Parmigiani Júnior >> > > > > > Araçatuba - SP >> > > > > > E-mail/MSN: [email protected] >> > > > > > ==================================== >> > >> > > > > > On 26 maio, 14:48, Bruno Ricciardi <[email protected]> >> wrote: >> > >> > > > > > > Poderia ter algo haver com o tal de cross domain?? >> > >> > > > > > > 2009/5/26 Bruno <[email protected]> >> > >> > > > > > > > Aiinda teria esse terceiro codigo que tbm retorna o mesmo >> erro: >> > >> > > > > > > > <?xml version="1.0" encoding="utf-8"?> >> > > > > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> > > > > > > > creationComplete="xMIIData.Xacute.send()"> >> > > > > > > > <mx:Script> >> > > > > > > > <![CDATA[ >> > > > > > > > import mx.events.ListEvent; >> > > > > > > > import mx.events.ItemClickEvent; >> > > > > > > > import >> mx.collections.ArrayCollection; >> > > > > > > > import mx.controls.Alert; >> > > > > > > > import mx.rpc.events.ResultEvent; >> > >> > > > > > > > [Bindable] >> > > > > > > > public var >> pieChartDP:ArrayCollection; >> > > > > > > > [Bindable] >> > > > > > > > public var >> xMIITrxData:ArrayCollection; >> > > > > > > > [Bindable] >> > > > > > > > public var radiusArr:Array = >> [0,.1,0]; //explode >> > > > > > > > Radius >> > >> > > > > > > > // Event Handler for 'Result' >> Event of >> > > > > > > > WebService >> > > > > > > > public function >> dataArrived(e:ResultEvent):void{ >> > > > > > > > xMIITrxData = >> > > > > > > > xMIIData.Xacute.lastResult.Rowset; >> > > > > > > > createPieChartDP(0); >> > > > > > > > } >> > >> > > > > > > > //Creating DataProvider for PieChart >> > > > > > > > public function >> > > > > > > > createPieChartDP(selectedRow:int):void{ >> > > > > > > > var obj:Object = >> > > > > > > > xMIITrxData.getItemAt(selectedRow); >> > > > > > > > pieChartDP = new >> ArrayCollection(); >> > > > > > > > >> pieChartDP.addItem({ParamName:"Performance", >> > > > > > > > Value:obj.L1Performance}); >> > >> > > > > > > > pieChartDP.addItem({ParamName:"Availability", >> > > > > > > > Value:obj.L1Availability}); >> > > > > > > > >> pieChartDP.addItem({ParamName:"Quality", >> > > > > > > > Value:obj.L1Quality}); >> > > > > > > > } >> > >> > > > > > > > //Callback function for PieChart >> labels >> > > > > > > > public function >> displayLabel(data:Object, >> > > > > > > > field:String, >> > > > > > > > index:Number, percentValue:Number):String{ >> > > > > > > > return data.ParamName; >> > > > > > > > } >> > >> > > > > > > > ]]> >> > > > > > > > </mx:Script> >> > > > > > > > <!-- Following Webservice fetches the data from xMII. >> 'wsdl' >> > > > > > > > property >> > > > > > > > has the path >> > > > > > > > for xMII Transaction wsdl. Any transaction >> exposed from >> > > > > > > > xMII has >> > > > > > > > operation >> > > > > > > > 'Xacute' which has no mandatory input >> parameters. That's >> > > > > > > > the >> > > > > > > > reason, there >> > > > > > > > is no parameter defined for WebService >> Request. >> > > > > > > > --> >> > > > > > > > <mx:WebService id="xMIIData" wsdl=" >> http://localhost/Lighthammer/ >> > > > > > > > WSDLGen/Flex/L1OEE < >> http://localhost/Lighthammer/%0AWSDLGen/Flex/L1OEE>"> >> > > > > > > > <mx:operation name="Xacute" fault="Alert.show >> > > > > > > > (event.fault.faultString, 'Error')" >> > > > > > > > result="dataArrived(event)"> >> > > > > > > > <mx:request> >> > > > > > > > <XacuteRequest> >> > > > > > > > </XacuteRequest> >> > > > > > > > </mx:request> >> > > > > > > > </mx:operation> >> > > > > > > > </mx:WebService> >> > > > > > > > <mx:Panel title="Flex-xMII" width="90%" >> height="70%"> >> > > > > > > > <mx:HBox width="100%" height="100%" >> verticalAlign="middle" >> > > > > > > > horizontalAlign="center"> >> > > > > > > > <mx:DataGrid width="65%" >> height="100%" >> > > > > > > > dataProvider="{xMIITrxData}" >> > >> > > > > > > > itemClick="createPieChartDP(event.rowIndex)"> >> > > > > > > > </mx:DataGrid> >> > > > > > > > <mx:PieChart id="piechart" >> width="35%" height="60%" >> > > > > > > > dataProvider="{pieChartDP}" showDataTips="true"> >> > > > > > > > <mx:series> >> > > > > > > > <mx:PieSeries >> displayName="LineData" >> > > > > > > > field="Value" >> > > > > > > > labelPosition="callout" >> > > > > > > > >> name="OEEDistribution" >> > > > > > > > perWedgeExplodeRadius="{radiusArr}" >> > > > > > > > nameField="ParamName" >> > >> > > > > > > > labelFunction="displayLabel"/> >> > > > > > > > </mx:series> >> > > > > > > > </mx:PieChart> >> > > > > > > > </mx:HBox> >> > > > > > > > </mx:Panel> >> > > > > > > > </mx:Application> >> > >> > > > > > > > On 26 maio, 14:38, >> > >> > ... >> > >> > mais »- Ocultar texto das mensagens anteriores - >> > >> > - Mostrar texto das mensagens anteriores - >> >> >> > --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para [email protected] Para sair da lista, envie um email em branco para [email protected] Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---
