Erro ao consumir webservice de consulta de cadastro

1,084 views
Skip to first unread message

helderam

unread,
Feb 27, 2012, 6:07:09 PM2/27/12
to NFePHP
Pessoal,

Boa noite,

Fiz um pequeno programa para testar e consultar situacao de cadastro
de algum cliente. Porem está retornando erro estranho referenciando ao
site http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaCadastro2/consultaCadastro2.

O problema é que este site não existe.

Alguem consegiu utilizar o metodo consultaCadastro ?

Grato
Helder
-------------------------------------------------------------
Segue o codigo
-------------------------------------------------------------

<?php

try {
require_once('../libs/ToolsNFePHP.class.php');

$nfe = new ToolsNFePHP;
header('Content-type: text/html; charset=UTF-8');

$sUF = 'SP'; ##-- SO SP este esta exigindo !!!

//determina o tipo de conector 1-SOAP ou 2-cURL
$modSOAP = '2';

//determina o ambiente 1-produção 2-homologação
$tpAmb= '2';

//habilita uso do scan
//$nfe->enableSCAN = true;

if($tpAmb == 1){
$sAmb='Produção';
} else {
$sAmb='Homologação';
}

echo '<pre> <BR><HR/><BR>';
echo "Verifica erro 1:". $nfe->errMsg.' : fim do erro 1 <BR>';

echo 'Inicio:'.$sUF . '[' . $sAmb . '] - modSOAP = ' . $modSOAP .
'<BR>';

$resp = $nfe->consultaCadastro('SP','23637077000504');

var_dump($resp);

echo '<BR>';
echo 'erro2: '.$nfe->errMsg.' : fim do erro <BR>';

echo '<PRE> SOAPPDEBUG : \n';
echo htmlspecialchars($nfe->soapDebug);

echo '</PRE><BR>';

echo 'Resultado: '.$UF . '[' . $sAmb . '] - ' . $resp['xMotivo'] .
'<BR><BR><HR/><BR>';

var_dump($nfe);

flush();

} catch (Exception $e) {
echo "atencao ERRO: ";
var_dump($e);
}
?>
---------------------------------------------------------------------
Vejam a resposta
---------------------------------------------------------------------

Verifica erro 1: : fim do erro 1
Inicio:SP[Homologação] - modSOAP = 2

resource(18) of type (curl)
string(794) "HTTP/1.1 500 Internal Server Error
Date: Mon, 27 Feb 2012 23:01:13 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 544

soap:SenderUnable to handle request. The action 'http://
www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaCadastro2/consultaCadastro2'
was not recognized."
array(3) {
["bStat"]=>
bool(false)
["cStat"]=>
string(0) ""
["dados"]=>
array(0) {
}
}

erro2: 500Internal Server Error
: fim do erro
SOAPPDEBUG : \n<?xml version="1.0" encoding="utf-8"?><soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://
www.w3.org/2003/05/soap-envelope"><soap12:Header><nfeCabecMsg
xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/
NfeConsultaCadastro2"><cUF>35</cUF><versaoDados>2.00</versaoDados></
nfeCabecMsg></soap12:Header><soap12:Body><nfeDadosMsg xmlns="http://
www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaCadastro2"><consCad
xmlns="http://www.portalfiscal.inf.br/nfe"
versao="2.00"><infCons><xServ>CONS-CAD</xServ><UF>SP</
UF><CNPJ>23637077000504</CNPJ></infCons></consCad><nfeDadosMsg></
soap12:Body></soap12:Envelope>

URL=https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/
CadConsultaCadastro2.asmx
Content type=application/soap+xml; charset=utf-8
Http Code=500
Header Size=250
Request Size=982
Filetime=-1
SSL Verify Result=0
Redirect Count=0
Total Time=0.770458
Namelookup=0.07081
Connect Time=0.138732
Pretransfer Time=0.402254
Size Upload=676
Size Download=544
Speed Download=706
Speed Upload=877
Download Content Length=544
Upload Content Length=676
Start Transfer Time=0.770377
Redirect Time=0
Certinfo=Array

HTTP/1.1 500 Internal Server Error
Date: Mon, 27 Feb 2012 23:01:13 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 544

<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/
XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</
soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Unable to
handle request. The action 'http://www.portalfiscal.inf.br/nfe/wsdl/
NfeConsultaCadastro2/consultaCadastro2' was not recognized.</
soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></
soap:Envelope>

Resultado: [Homologação] -


Fernando Mertins

unread,
Feb 28, 2012, 7:10:02 AM2/28/12
to nfe...@googlegroups.com
Olá, meses atrás eu também tentei consultar e lembro que dava algum erro, não sei se meu ou da API. Se eu conseguir volto a testar este método e retorno aqui no grupo o resultado.


helderam

unread,
Sep 6, 2014, 4:46:03 PM9/6/14
to nfe...@googlegroups.com
Pessoal,

Boa tarde,

Refiz o programa agora está funcionando bem para SP. Porem para MG aparece erro.

Será um problema no servidor do Governo de MG ?

Veja a resposta...

HTTP/1.1 200 OK Date: Sat, 06 Sep 2014 20:43:30 GMT Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0k DAV/2 mod_jk/1.2.28 X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0 Content-Length: 718 Content-Type: application/soap+xml;charset=UTF-8 <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><nfeCabecMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/CadConsultaCadastro2"><cUF>31</cUF><versaoDados>2.00</versaoDados></nfeCabecMsg></soap:Header><soap:Body><consultaCadastro2Result xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/CadConsultaCadastro2"><retConsCad xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00"> <infCons> <verAplic>13_2_25</verAplic> <cStat>999</cStat> <xMotivo>Rejeicao: Erro nao catalogado</xMotivo> <UF>MG</UF> <CNPJ>19778648000111</CNPJ> <dhCons>2014-09-06T17:43:30</dhCons> <cUF>31</cUF> </infCons> </retConsCad></consultaCadastro2Result></soap:Body></soap:Envelope>

helderam

unread,
Sep 8, 2014, 6:38:11 PM9/8/14
to nfe...@googlegroups.com
Alguem ?


Em segunda-feira, 27 de fevereiro de 2012 20h07min09s UTC-3, helderam escreveu:

Walber Sales

unread,
Sep 8, 2014, 10:12:48 PM9/8/14
to nfe...@googlegroups.com
Olá,

Usamos UF apenas para GO e MG.
Mas a URL é portalfiscal,inf.br para SP?

Abs,

Walber Sales

<homologacao>
<NfeRecepcao method='nfeRecepcaoLote2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeRecepcao2.asmx</NfeRecepcao>
<NfeRetRecepcao method='nfeRetRecepcao2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeRetRecepcao2.asmx</NfeRetRecepcao>
<NfeCancelamento method='nfeCancelamentoNF2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeCancelamento2.asmx</NfeCancelamento>
<NfeInutilizacao method='nfeInutilizacaoNF2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeInutilizacao2.asmx</NfeInutilizacao>
<NfeConsulta method='nfeConsultaNF2'
version='2.01'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeConsulta2.asmx</NfeConsulta>
<NfeStatusServico method='nfeStatusServicoNF2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeStatusServico2.asmx</NfeStatusServico>
<CadConsultaCadastro method='consultaCadastro2'
version='2.00'>https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/CadConsultaCadastro2.asmx</CadConsultaCadastro>
<RecepcaoEvento method='nfeRecepcaoEvento'
version='1.00'>https://homologacao.nfe.fazenda.sp.gov.br/eventosWEB/services/RecepcaoEvento.asmx</RecepcaoEvento>
<NfeConsultaDest method='nfeConsultaNFDest' version='1.00'></NfeConsultaDest>
<NfeDownloadNF method='nfeDownloadNF' version='1.00'></NfeDownloadNF>
</homologacao>
<producao>
<NfeRecepcao method='nfeRecepcaoLote2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nferecepcao2.asmx</NfeRecepcao>
<NfeRetRecepcao method='nfeRetRecepcao2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nferetrecepcao2.asmx</NfeRetRecepcao>
<NfeCancelamento method='nfeCancelamentoNF2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nfecancelamento2.asmx</NfeCancelamento>
<NfeInutilizacao method='nfeInutilizacaoNF2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nfeinutilizacao2.asmx</NfeInutilizacao>
<NfeConsulta method='nfeConsultaNF2'
version='2.01'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nfeconsulta2.asmx</NfeConsulta>
<NfeStatusServico method='nfeStatusServicoNF2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico2.asmx</NfeStatusServico>
<CadConsultaCadastro method='consultaCadastro2'
version='2.00'>https://nfe.fazenda.sp.gov.br/nfeweb/services/cadconsultacadastro2.asmx</CadConsultaCadastro>
<RecepcaoEvento method='nfeRecepcaoEvento'
version='1.00'>https://nfe.fazenda.sp.gov.br/eventosWEB/services/RecepcaoEvento.asmx</RecepcaoEvento>
<NfeConsultaDest method='nfeConsultaNFDest' version='1.00'></NfeConsultaDest>
<NfeDownloadNF method='nfeDownloadNF' version='1.00'></NfeDownloadNF>


Em 8 de setembro de 2014 19:38, helderam
<helder.afon...@gmail.com> escreveu:
> --
> --
> Você recebeu esta mensagem porque está inscrito no Grupo "NFePHP".
> Para Postar: nfe...@googlegroups.com
> Para Sair do Grupo: nfephp+un...@googlegroups.com
> Link: http://groups.google.com.br/group/nfephp?hl=pt-BR
> -------
> Repositório: https://github.com/nfephp-org/nfephp
> ---
> Você recebeu essa mensagem porque está inscrito no grupo quot;NFePHP" dos
> Grupos do Google.
> Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie
> um e-mail para nfephp+un...@googlegroups.com.
> Para mais opções, acesse https://groups.google.com/d/optout.

marcio rodrigo

unread,
Jan 5, 2015, 8:55:24 AM1/5/15
to nfe...@googlegroups.com
Amigo, estou com o mesmo problema na consulta de SP, como vc resolveu o seu ?
Reply all
Reply to author
Forward
0 new messages