Olá gujeiros, tudo bem???
estou com um pequeno problema…
tenho uma aplicação q chama um webservice para consultar cep.
estava funcionando belezinha
ele faz a string certinho
e talz
mas começou a dar o seguinte erro…
faultCode:Channel.Security.Error faultString:‘Security error accessing url’ faultDetail:‘Destination: DefaultHTTP’
alguem imagina o q pode ser?
vou postar o q faz parte do metodo.
vlw!!!
A parte que ele verifica as informações…
[code]private function pesquisarCep(tipo:String):void{
if(tipo=="res"){
if(txtEndereco.text!= ""){
tipoConsulta = "End"
if(txtCidade.text=="" || txtBairro.text==""){
if(txtCidade.text==""){
Alert.show("Digite uma cidade","Cidade");
}
if(txtBairro.text==""){
Alert.show("Digite um Bairro","Bairro");
}
}
else{
//urlCep = objCep.urlCep;
//Alert.show(urlCep);
//buscaCep.url = "http://www.buscarcep.com.br/?logradouro="+txtEndereco.text+ "&cidade="+ txtCidade.text+"&bairro=" + txtBairro.text + "&formato=xml&chave=1KbuaLnEKvkhMQlq4GVdA8YUlmpaSh1";
buscaCep.url = urlCep+"?logradouro="+txtEndereco.text+ "&cidade="+ txtCidade.text+"&bairro=" + txtBairro.text + "&formato=xml&chave="+urlSenhaCep;
buscaCep.send();
//Alert.show(urlSenhaCep);
}
}
else if (txtCEP.text!="" && txtCEP.text.length == 8 ){
tipoConsulta = "Cep";
buscaCep.url = urlCep+ "?formato=xml&cep=" + txtCEP.text + "&chave="+urlSenhaCep;
buscaCep.send();
// Alert.show("http://www.buscarcep.com.br/?formato=xml&cep=" + txtCep.text + txtCepCompl.text+ "&chave=1KbuaLnEKvkhMQlq4GVdA8YUlmpaSh1","Teste");
//Alert.show(urlCep+ "?formato=xml&cep=" + txtCEP.text + "&chave="+urlSenhaCep);
}
else{
Alert.show("Digite algum Endereço, ou CEP para fazer a Busca.", "Busca")
}
}else if(tipo=="comer"){
if(txtEnderecoComercial.text!= ""){
tipoConsulta = "EndComer"
if(txtCidadeComercial.text=="" || txtBairroComercial.text==""){
if(txtCidadeComercial.text==""){
Alert.show("Digite uma cidade Comercial.","Cidade Comercial");
}
if(txtBairroComercial.text==""){
Alert.show("Digite um Bairro Comercial","Bairro");
}
}
else{
//Alert.show(txtEndereco.text,"Teste");
// Alert.show("http://www.buscarcep.com.br/?logradouro="+txtEndereco.text+ "&cidade="+ txtCidade.text+ "&formato=xml&chave=1KbuaLnEKvkhMQlq4GVdA8YUlmpaSh1","Busca CEP");
buscaCep.url = urlCep+"?logradouro="+txtEnderecoComercial.text+ "&cidade="+ txtCidadeComercial.text+"&bairro=" + txtBairroComercial.text + "&formato=xml&chave="+urlSenhaCep;
buscaCep.send();
}
}
else if (txtCEPComercial.text!="" && txtCEPComercial.text.length == 8 ){
tipoConsulta = "CepComer";
buscaCep.url = urlCep+"?formato=xml&cep=" + txtCEPComercial.text + "&chave="+urlSenhaCep;
buscaCep.send();
// Alert.show("http://www.buscarcep.com.br/?formato=xml&cep=" + txtCep.text + txtCepCompl.text+ "&chave=1KbuaLnEKvkhMQlq4GVdA8YUlmpaSh1","Teste");
//Alert.show(txtCEP.text,"Teste");
}
else{
Alert.show("Digite algum Endereço, ou CEP para fazer a Busca.", "Busca")
}
}
}[/code]
chamando o HTTPService
a parte do retorno
[code]private function cepResultHandler(event:ResultEvent):void{
//HTTPService returns an XML Document
var resultXML:XMLList = new XMLList(new XML(event.result));
if(tipoConsulta=="Cep"){
if (resultXML != null && resultXML.retorno.resultado == 1){
this.txtEndereco.text = new String(resultXML.retorno.logradouro);
this.txtBairro.text = new String(resultXML.retorno.bairro);
this.txtCidade.text = new String(resultXML.retorno.cidade);
this.txtEstado.text = new String(resultXML.retorno.uf);
} else {
this.txtEndereco.text = "";
this.txtBairro.text = "";
this.txtCidade.text = "";
this.txtEstado.text = "";
Alert.show("Cep Não Existe.\nDigite um CEP válido!","Busca CEP");
}
}else if (tipoConsulta=="End"){
if (resultXML != null && resultXML.retorno.resultado[0] == 1){
this.txtCEP.text = new String(resultXML.retorno.cep[0]);
} else {
Alert.show("Endereço inválido!","Busca CEP");
}
}
else if(tipoConsulta=="CepComer"){
if (resultXML != null && resultXML.retorno.resultado == 1){
this.txtEnderecoComercial.text = new String(resultXML.retorno.logradouro);
this.txtBairroComercial.text = new String(resultXML.retorno.bairro);
this.txtCidadeComercial.text = new String(resultXML.retorno.cidade);
this.txtEstadoComercial.text = new String(resultXML.retorno.uf);
} else {
this.txtEnderecoComercial.text = "";
this.txtBairroComercial.text = "";
this.txtCidadeComercial.text = "";
this.txtEstadoComercial.text = "";
Alert.show("Cep Não Existe.\nDigite um CEP válido!","Busca CEP");
}
}else if (tipoConsulta=="EndComer"){
if (resultXML != null && resultXML.retorno.resultado[0] == 1){
this.txtCEPComercial.text = new String(resultXML.retorno.cep[0]);
} else {
Alert.show("Endereço inválido!","Busca CEP");
}
}
}[/code]
e o retorno caso dê algum erro…
public function onFault(fault:FaultEvent):void
{
Alert.show(fault.fault.message);
}
se alguem puder ajudar!!!
agradeço!!!