Ola a todos!! seguinte, sou novo com Flex e tenho que fazer uma chamada a um WS... ja tentei varios codigos... e nada... a maioria tenho como resultado "SOAP Response cannot be decoded. Raw response"
por favlr, me falem o que falta para um dos codigos a seguir funcionar!!! Muito obrigado! Teria alguma maneira mais simples de criar WS clients?? *CODIGO 1: *<?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"; 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 { Alert.show((event.result as Object).myInfo); } 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> *CODIGO 2*: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private function FaultHandler(event:FaultEvent):void { Alert.show(event.fault.message, "Não foi possivel conectar no Web Service"); } private function resultHandler(event:ResultEvent):void { //Alert.show(String(event.result.cep.bairro),""); Alert.show(String(CEPService1.cep.lastResult), ""); } ]]> </mx:Script> <mx:WebService wsdl="http://www.bronzebusiness.com.br/webservices/wscep.asmx?wsdl" useProxy="false" id="CEPService1" fault="FaultHandler(event);" showBusyCursor="true" result="resultHandler(event);"> <mx:operation name="cep"> <mx:request> </mx:request> </mx:operation> </mx:WebService> <mx:Panel y="71" width="397" height="223" layout="absolute" title="Consulta CEP" toolTip="By zSolutions - www.zsolutions.com.br " horizontalCenter="0.5"> <mx:TextInput x="75" y="10" width="101" id="txtCEP" maxChars="8" restrict="0-9" /> <mx:Label x="10" y="12" text="CEP:"/> <mx:Button x="184" y="10" label="Buscar" click="CEPService1.cep.send()"/> <mx:Label x="6" y="83" text="Endereço"/> <mx:TextInput x="65" y="81" width="302" text="{CEPService1.cep.lastResult.enderecoLogradouro}"/> <mx:Label x="6" y="109" text="Bairro" /> <mx:TextInput x="65" y="107" id="txtBairro" text="{CEPService1.cep.lastResult.bairro}" width="142"/> <mx:Label x="6" y="135" text="Estado" /> <mx:TextInput x="65" y="133" text="{CEPService1.cep.lastResult.estadoNome}" width="142"/> <mx:Label x="215" y="135" text="UF" /> <mx:TextInput x="269" y="133" width="52" text="{CEPService1.cep.lastResult.estadoSigla}"/> <mx:Label x="215" y="109" text="Cidade"/> <mx:TextInput x="269" y="107" id="txtCidade" width="98"/> </mx:Panel> </mx:Application> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
