prodis / correios-cep

Find Brazilian addresses by zipcode, directly from Correios database. No HTML parsers.
Apache License 2.0
168 stars 33 forks source link

Handle errors returned from Correios web service #10

Closed prodis closed 9 years ago

prodis commented 9 years ago
> Correios::CEP::AddressFinder.get('99999999')
I, [2015-05-04T21:56:58.776045 #95924]  INFO -- : [Correios::CEP] Request:
POST https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/"><soapenv:Header /><soapenv:Body><cli:consultaCEP><cep>99999999</cep></cli:consultaCEP></soapenv:Body></soapenv:Envelope>

I, [2015-05-04T21:56:58.847276 #95924]  INFO -- : [Correios::CEP] Response:
HTTP/1.1 500 Internal Server Error
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>CEP NAO ENCONTRADO</faultstring><detail><ns2:SigepClienteException xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/">CEP NAO ENCONTRADO</ns2:SigepClienteException></detail></soap:Fault></soap:Body></soap:Envelope>

NoMethodError: undefined method `name' for "soap:Server":String
prodis commented 9 years ago

Solved in version 0.5.0.