erro ao tentar enviar NF o (Tutorial)

64 views
Skip to first unread message

Bernardo Hoehl

unread,
Dec 16, 2010, 10:19:28 AM12/16/10
to nfe...@googlegroups.com
Amigos,


Eu estou aqui fazendo o tutorial, e para isso deixei de lado a pasta do NFePHP que tenho funcional e criei uma nova, do zero.

Estou tendo o erro "FALHA no envio !! cStat : 226Motivo : Rejeicao: Codigo da UF do Emitente diverge da UF autorizadora"

Me recordo estar tendo este erro aqui quando comecei usar o NFephp, mas não lembro mais a solução.

Já conferi o tag cUF dentro do XML e a UF informada no config.php. Tudo está correto.

O XML passa no validador de mensagens.

Alguém pode me dar uma dica?

Obrigado!


Bernardo

FerreiraH.

unread,
Dec 16, 2010, 5:24:35 PM12/16/10
to nfe...@googlegroups.com
voce esta enviando para uma SEFAZ autorizadora diferente da que deveria foi isso que entendi.




--
Ferreira Helder
B2Stok.net  B2Stok
Voce pode colaborar

Bernardo Hoehl

unread,
Dec 16, 2010, 6:00:01 PM12/16/10
to nfe...@googlegroups.com
Ferreira,


Veja o debug do envio, colocando uma linha no ToolsNFePHP assim:

print $this->soapDebug;

Note o que destaco em vermelho: (alguma dica????)

2010-12-16 20:55:24.717526 nusoap_client: ctor wsdl=1 timeout=0 response_timeout=30 endpoint=string(83) "https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL" 2010-12-16 20:55:24.717585 nusoap_client: will use lazy evaluation of wsdl from https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL 2010-12-16 20:55:24.717650 nusoap_client: call: operation=nfeRecepcaoLote, namespace=http://tempuri.org, soapAction=, rpcParams=, style=rpc, use=encoded, endpointType=wsdl params=array(2) { ["nfeCabecMsg"]=> string(147) "<?xml version="1.0" encoding="utf-8"?><cabecMsg versao="1.02" xmlns="http://www.portalfiscal.inf.br/nfe"><versaoDados>1.10</versaoDados></cabecMsg>" ["nfeDadosMsg"]=> string(196) "<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.10"><idLote>254</idLote></enviNFe>" } headers=bool(false) 2010-12-16 20:55:24.717696 nusoap_client: instantiating wsdl class with doc: https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL 2010-12-16 20:55:24.717764 wsdl: ctor wsdl= timeout=0 response_timeout=30 2010-12-16 20:55:24.717801 wsdl: parse and process WSDL path= 2010-12-16 20:55:24.717848 wsdl: setCredentials username= authtype=certificate certRequest= array(6) { ["sslkeyfile"]=> string(65) "/Library/WebServer/Documents/nfephp_tutorial/certs/privatekey.pem" ["sslcertfile"]=> string(64) "/Library/WebServer/Documents/nfephp_tutorial/certs/publickey.pem" ["passphrase"]=> string(0) "" ["verifypeer"]=> bool(false) ["verifyhost"]=> bool(false) ["trace"]=> int(1) } 2010-12-16 20:55:24.717889 wsdl: parse and process WSDL path=https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL 2010-12-16 20:55:24.717922 wsdl: parse WSDL at path=https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL 2010-12-16 20:55:24.717954 wsdl: getting WSDL http(s) URL https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL 2010-12-16 20:55:24.718100 soap_transport_http: ctor url=https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL use_curl= curl_options: array(0) { } 2010-12-16 20:55:24.718144 soap_transport_http: parsed URL scheme = https 2010-12-16 20:55:24.718169 soap_transport_http: parsed URL host = homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:24.718193 soap_transport_http: parsed URL path = /ws/nferecepcao/NfeRecepcao.asmx 2010-12-16 20:55:24.718216 soap_transport_http: parsed URL query = WSDL 2010-12-16 20:55:24.718248 soap_transport_http: set header Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:24.718292 soap_transport_http: set header User-Agent: NuSOAP/0.7.3 (1.114) 2010-12-16 20:55:24.718332 soap_transport_http: setCredentials username= authtype=certificate digestRequest= array(0) { } 2010-12-16 20:55:24.718362 soap_transport_http: certRequest= array(6) { ["sslkeyfile"]=> string(65) "/Library/WebServer/Documents/nfephp_tutorial/certs/privatekey.pem" ["sslcertfile"]=> string(64) "/Library/WebServer/Documents/nfephp_tutorial/certs/publickey.pem" ["passphrase"]=> string(0) "" ["verifypeer"]=> bool(false) ["verifyhost"]=> bool(false) ["trace"]=> int(1) } 2010-12-16 20:55:24.718398 soap_transport_http: Authorization header not set for certificate 2010-12-16 20:55:24.718428 soap_transport_http: set header Accept-Encoding: gzip, deflate 2010-12-16 20:55:24.718455 soap_transport_http: set header Connection: close 2010-12-16 20:55:24.718487 soap_transport_http: entered send() with data of length: 0 2010-12-16 20:55:24.718530 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme https, host homologacao.nfe.sefazvirtual.rs.gov.br, port 443 2010-12-16 20:55:24.718570 soap_transport_http: connect using cURL 2010-12-16 20:55:24.718617 soap_transport_http: setCurlOption option=10002, value= string(87) "https://homologacao.nfe.sefazvirtual.rs.gov.br:443/ws/nferecepcao/NfeRecepcao.asmx?WSDL" 2010-12-16 20:55:24.718657 soap_transport_http: setCurlOption option=52, value= int(1) 2010-12-16 20:55:24.718689 soap_transport_http: setCurlOption option=42, value= int(1) 2010-12-16 20:55:24.718719 soap_transport_http: setCurlOption option=19913, value= int(1) 2010-12-16 20:55:24.718757 soap_transport_http: setCurlOption option=13, value= int(30) 2010-12-16 20:55:24.718787 soap_transport_http: set cURL SSL verify options 2010-12-16 20:55:24.718810 soap_transport_http: setCurlOption option=64, value= int(0) 2010-12-16 20:55:24.718839 soap_transport_http: setCurlOption option=81, value= int(0) 2010-12-16 20:55:24.718868 soap_transport_http: set cURL certificate options 2010-12-16 20:55:24.718894 soap_transport_http: setCurlOption option=64, value= bool(false) 2010-12-16 20:55:24.718925 soap_transport_http: setCurlOption option=81, value= bool(false) 2010-12-16 20:55:24.718956 soap_transport_http: setCurlOption option=10025, value= string(64) "/Library/WebServer/Documents/nfephp_tutorial/certs/publickey.pem" 2010-12-16 20:55:24.718988 soap_transport_http: setCurlOption option=10087, value= string(65) "/Library/WebServer/Documents/nfephp_tutorial/certs/privatekey.pem" 2010-12-16 20:55:24.719023 soap_transport_http: setCurlOption option=10026, value= string(0) "" 2010-12-16 20:55:24.719055 soap_transport_http: cURL connection set up 2010-12-16 20:55:24.719088 soap_transport_http: set header Content-Length: 0 2010-12-16 20:55:24.719113 soap_transport_http: HTTP request: GET /ws/nferecepcao/NfeRecepcao.asmx?WSDL HTTP/1.1 2010-12-16 20:55:24.719138 soap_transport_http: HTTP header: Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:24.719161 soap_transport_http: HTTP header: User-Agent: NuSOAP/0.7.3 (1.114) 2010-12-16 20:55:24.719185 soap_transport_http: HTTP header: Accept-Encoding: gzip, deflate 2010-12-16 20:55:24.719207 soap_transport_http: HTTP header: Connection: close 2010-12-16 20:55:24.719231 soap_transport_http: HTTP header: Content-Length: 0 2010-12-16 20:55:24.719262 soap_transport_http: Skip cURL header Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:24.719290 soap_transport_http: Skip cURL header Connection: close 2010-12-16 20:55:24.719314 soap_transport_http: Skip cURL header Content-Length: 0 2010-12-16 20:55:24.719338 soap_transport_http: setCurlOption option=10023, value= array(2) { [0]=> string(32) "User-Agent: NuSOAP/0.7.3 (1.114)" [1]=> string(30) "Accept-Encoding: gzip, deflate" } 2010-12-16 20:55:24.719373 soap_transport_http: set cURL HTTP headers 2010-12-16 20:55:24.719399 soap_transport_http: set cURL payload 2010-12-16 20:55:24.719436 soap_transport_http: send and receive with cURL 2010-12-16 20:55:27.240091 soap_transport_http: No cURL error, closing cURL 2010-12-16 20:55:27.240818 soap_transport_http: found proper separation of headers and document 2010-12-16 20:55:27.240851 soap_transport_http: cleaned data, stringlen: 3418 2010-12-16 20:55:27.240981 soap_transport_http: No Content-Encoding header 2010-12-16 20:55:27.241014 soap_transport_http: end of send() 2010-12-16 20:55:27.241058 wsdl: got WSDL URL 2010-12-16 20:55:27.241081 wsdl: Parse WSDL 2010-12-16 20:55:27.241408 wsdl: Parsing WSDL schema 2010-12-16 20:55:27.241481 nusoap_xmlschema: nusoap_xmlschema class instantiated, inside constructor 2010-12-16 20:55:27.241663 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing untyped element nfeRecepcaoLote type _nfeRecepcaoLote_ContainedType 2010-12-16 20:55:27.241695 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> add element nfeRecepcaoLote to elements array 2010-12-16 20:55:27.241767 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing unnamed complexType for element nfeRecepcaoLote named _nfeRecepcaoLote_ContainedType 2010-12-16 20:55:27.241897 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing typed element nfeCabecMsg of type http://www.w3.org/2001/XMLSchema:string 2010-12-16 20:55:27.241933 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> add element nfeCabecMsg to complexType _nfeRecepcaoLote_ContainedType 2010-12-16 20:55:27.241985 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing element nfeCabecMsg 2010-12-16 20:55:27.242072 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing typed element nfeDadosMsg of type http://www.w3.org/2001/XMLSchema:string 2010-12-16 20:55:27.242106 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> add element nfeDadosMsg to complexType _nfeRecepcaoLote_ContainedType 2010-12-16 20:55:27.242157 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing element nfeDadosMsg 2010-12-16 20:55:27.242225 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing complexType _nfeRecepcaoLote_ContainedType 2010-12-16 20:55:27.242274 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing element nfeRecepcaoLote 2010-12-16 20:55:27.242428 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing untyped element nfeRecepcaoLoteResponse type _nfeRecepcaoLoteResponse_ContainedType 2010-12-16 20:55:27.242459 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> add element nfeRecepcaoLoteResponse to elements array 2010-12-16 20:55:27.242526 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing unnamed complexType for element nfeRecepcaoLoteResponse named _nfeRecepcaoLoteResponse_ContainedType 2010-12-16 20:55:27.242650 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> processing typed element nfeRecepcaoLoteResult of type http://www.w3.org/2001/XMLSchema:string 2010-12-16 20:55:27.242685 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> add element nfeRecepcaoLoteResult to complexType _nfeRecepcaoLoteResponse_ContainedType 2010-12-16 20:55:27.242735 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing element nfeRecepcaoLoteResult 2010-12-16 20:55:27.242802 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing complexType _nfeRecepcaoLoteResponse_ContainedType 2010-12-16 20:55:27.242851 nusoap_xmlschema: <http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao> done processing element nfeRecepcaoLoteResponse 2010-12-16 20:55:27.242899 wsdl: Parsing WSDL schema done 2010-12-16 20:55:27.243024 wsdl: msg nfeRecepcaoLoteSoapIn: found part (with element) parameters: parameters,http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote 2010-12-16 20:55:27.243157 wsdl: msg nfeRecepcaoLoteSoapOut: found part (with element) parameters: parameters,http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLoteResponse 2010-12-16 20:55:27.243274 wsdl: portType NfeRecepcaoSoap operation: nfeRecepcaoLote 2010-12-16 20:55:27.243487 wsdl: current binding: NfeRecepcaoSoap of portType: http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:NfeRecepcaoSoap 2010-12-16 20:55:27.243600 wsdl: current binding operation: nfeRecepcaoLote 2010-12-16 20:55:27.243921 wsdl: current binding: NfeRecepcaoSoap12 of portType: http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:NfeRecepcaoSoap 2010-12-16 20:55:27.244036 wsdl: current binding operation: nfeRecepcaoLote 2010-12-16 20:55:27.244329 wsdl: current service: NfeRecepcao 2010-12-16 20:55:27.244410 wsdl: current port: NfeRecepcaoSoap 2010-12-16 20:55:27.244547 wsdl: current port: NfeRecepcaoSoap12 2010-12-16 20:55:27.244672 wsdl: Parsing WSDL done 2010-12-16 20:55:27.244722 wsdl: post-parse data gathering for nfeRecepcaoLote 2010-12-16 20:55:27.244791 wsdl: post-parse data gathering for nfeRecepcaoLote 2010-12-16 20:55:27.244863 nusoap_client: checkWSDL 2010-12-16 20:55:27.244904 nusoap_client: got 1 operations from wsdl https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx?WSDL for binding type soap 2010-12-16 20:55:27.244938 nusoap_client: found operation opData=array(9) { ["name"]=> string(15) "nfeRecepcaoLote" ["binding"]=> string(15) "NfeRecepcaoSoap" ["endpoint"]=> string(78) "https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx" ["soapAction"]=> string(67) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote" ["style"]=> string(8) "document" ["input"]=> array(3) { ["use"]=> string(7) "literal" ["message"]=> string(21) "nfeRecepcaoLoteSoapIn" ["parts"]=> array(1) { ["parameters"]=> string(68) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote^" } } ["output"]=> array(3) { ["use"]=> string(7) "literal" ["message"]=> string(22) "nfeRecepcaoLoteSoapOut" ["parts"]=> array(1) { ["parameters"]=> string(76) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLoteResponse^" } } ["transport"]=> string(36) "http://schemas.xmlsoap.org/soap/http" ["documentation"]=> string(0) "" } 2010-12-16 20:55:27.245016 nusoap_client: serializing param array for WSDL operation nfeRecepcaoLote 2010-12-16 20:55:27.245044 wsdl: in serializeRPCParameters: operation=nfeRecepcaoLote, direction=input, XMLSchemaVersion=http://www.w3.org/2001/XMLSchema, bindingType=soap parameters=array(2) { ["nfeCabecMsg"]=> string(147) "<?xml version="1.0" encoding="utf-8"?><cabecMsg versao="1.02" xmlns="http://www.portalfiscal.inf.br/nfe"><versaoDados>1.10</versaoDados></cabecMsg>" ["nfeDadosMsg"]=> string(196) "<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.10"><idLote>254</idLote></enviNFe>" } 2010-12-16 20:55:27.245093 wsdl: in serializeRPCParameters: opData: array(9) { ["name"]=> string(15) "nfeRecepcaoLote" ["binding"]=> string(15) "NfeRecepcaoSoap" ["endpoint"]=> string(78) "https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx" ["soapAction"]=> string(67) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote" ["style"]=> string(8) "document" ["input"]=> array(3) { ["use"]=> string(7) "literal" ["message"]=> string(21) "nfeRecepcaoLoteSoapIn" ["parts"]=> array(1) { ["parameters"]=> string(68) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote^" } } ["output"]=> array(3) { ["use"]=> string(7) "literal" ["message"]=> string(22) "nfeRecepcaoLoteSoapOut" ["parts"]=> array(1) { ["parameters"]=> string(76) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLoteResponse^" } } ["transport"]=> string(36) "http://schemas.xmlsoap.org/soap/http" ["documentation"]=> string(0) "" } 2010-12-16 20:55:27.245150 wsdl: have 1 part(s) to serialize using document/literal 2010-12-16 20:55:27.245180 wsdl: have 2 parameter(s) provided as arrayStruct to serialize 2010-12-16 20:55:27.245203 wsdl: check whether the caller has wrapped the parameters 2010-12-16 20:55:27.245226 wsdl: check whether caller's parameters match the wrapped ones 2010-12-16 20:55:27.245250 wsdl: in parametersMatchWrapped type=http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote^, parameters= array(2) { ["nfeCabecMsg"]=> string(147) "<?xml version="1.0" encoding="utf-8"?><cabecMsg versao="1.02" xmlns="http://www.portalfiscal.inf.br/nfe"><versaoDados>1.10</versaoDados></cabecMsg>" ["nfeDadosMsg"]=> string(196) "<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.10"><idLote>254</idLote></enviNFe>" } 2010-12-16 20:55:27.245286 wsdl: in parametersMatchWrapped: got a prefixed type: nfeRecepcaoLote^, http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245313 wsdl: in getTypeDef: type=nfeRecepcaoLote^, ns=http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245339 wsdl: in getTypeDef: have schema for namespace http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245503 wsdl: in parametersMatchWrapped: found typeDef= array(6) { ["name"]=> string(15) "nfeRecepcaoLote" ["form"]=> string(9) "qualified" ["type"]=> string(82) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:_nfeRecepcaoLote_ContainedType" ["typeClass"]=> string(7) "element" ["phpType"]=> string(6) "struct" ["elements"]=> array(2) { ["nfeCabecMsg"]=> array(5) { ["minOccurs"]=> string(1) "0" ["maxOccurs"]=> string(1) "1" ["name"]=> string(11) "nfeCabecMsg" ["type"]=> string(39) "http://www.w3.org/2001/XMLSchema:string" ["form"]=> string(9) "qualified" } ["nfeDadosMsg"]=> array(5) { ["minOccurs"]=> string(1) "0" ["maxOccurs"]=> string(1) "1" ["name"]=> string(11) "nfeDadosMsg" ["type"]=> string(39) "http://www.w3.org/2001/XMLSchema:string" ["form"]=> string(9) "qualified" } } } 2010-12-16 20:55:27.245553 wsdl: in parametersMatchWrapped: uqType: nfeRecepcaoLote, ns: http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao, phptype: struct, arrayType: 2010-12-16 20:55:27.245587 wsdl: in parametersMatchWrapped: have parameter named nfeCabecMsg 2010-12-16 20:55:27.245611 wsdl: in parametersMatchWrapped: have parameter named nfeDadosMsg 2010-12-16 20:55:27.245635 wsdl: in parametersMatchWrapped: 2 parameter names match 2 wrapped parameter names 2010-12-16 20:55:27.245658 wsdl: wrap the parameters for the caller 2010-12-16 20:55:27.245681 wsdl: serializing part parameters of type http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote^ 2010-12-16 20:55:27.245705 wsdl: calling serializeType w/named param 2010-12-16 20:55:27.245731 wsdl: in serializeType: name=parameters, type=http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote^, use=literal, encodingStyle=, unqualified=qualified value=array(2) { ["nfeCabecMsg"]=> string(147) "<?xml version="1.0" encoding="utf-8"?><cabecMsg versao="1.02" xmlns="http://www.portalfiscal.inf.br/nfe"><versaoDados>1.10</versaoDados></cabecMsg>" ["nfeDadosMsg"]=> string(196) "<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.10"><idLote>254</idLote></enviNFe>" } 2010-12-16 20:55:27.245769 wsdl: in serializeType: got a prefixed type: nfeRecepcaoLote^, http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245796 wsdl: in getTypeDef: type=nfeRecepcaoLote^, ns=http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245819 wsdl: in getTypeDef: have schema for namespace http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao 2010-12-16 20:55:27.245876 wsdl: in serializeType: found typeDef typeDef=array(6) { ["name"]=> string(15) "nfeRecepcaoLote" ["form"]=> string(9) "qualified" ["type"]=> string(82) "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:_nfeRecepcaoLote_ContainedType" ["typeClass"]=> string(7) "element" ["phpType"]=> string(6) "struct" ["elements"]=> array(2) { ["nfeCabecMsg"]=> array(5) { ["minOccurs"]=> string(1) "0" ["maxOccurs"]=> string(1) "1" ["name"]=> string(11) "nfeCabecMsg" ["type"]=> string(39) "http://www.w3.org/2001/XMLSchema:string" ["form"]=> string(9) "qualified" } ["nfeDadosMsg"]=> array(5) { ["minOccurs"]=> string(1) "0" ["maxOccurs"]=> string(1) "1" ["name"]=> string(11) "nfeDadosMsg" ["type"]=> string(39) "http://www.w3.org/2001/XMLSchema:string" ["form"]=> string(9) "qualified" } } } 2010-12-16 20:55:27.245925 wsdl: in serializeType: uqType: nfeRecepcaoLote, ns: http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao, phptype: struct, arrayType: 2010-12-16 20:55:27.245956 wsdl: no attributes to serialize for XML Schema type http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote 2010-12-16 20:55:27.245987 wsdl: in serializeComplexTypeElements, serialize elements for XML Schema type http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao:nfeRecepcaoLote 2010-12-16 20:55:27.246022 wsdl: in serializeType: name=nfeCabecMsg, type=http://www.w3.org/2001/XMLSchema:string, use=literal, encodingStyle=, unqualified=qualified value=string(147) "<?xml version="1.0" encoding="utf-8"?><cabecMsg versao="1.02" xmlns="http://www.portalfiscal.inf.br/nfe"><versaoDados>1.10</versaoDados></cabecMsg>" 2010-12-16 20:55:27.246058 wsdl: in serializeType: got a prefixed type: string, http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246082 wsdl: in serializeType: type namespace indicates XML Schema or SOAP Encoding type 2010-12-16 20:55:27.246125 wsdl: in getTypeDef: type=string, ns=http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246152 wsdl: in getTypeDef: do not have schema for namespace http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246177 wsdl: in serializeType: returning: <nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg> 2010-12-16 20:55:27.246209 wsdl: in serializeType: name=nfeDadosMsg, type=http://www.w3.org/2001/XMLSchema:string, use=literal, encodingStyle=, unqualified=qualified value=string(196) "<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.10"><idLote>254</idLote></enviNFe>" 2010-12-16 20:55:27.246243 wsdl: in serializeType: got a prefixed type: string, http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246267 wsdl: in serializeType: type namespace indicates XML Schema or SOAP Encoding type 2010-12-16 20:55:27.246305 wsdl: in getTypeDef: type=string, ns=http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246331 wsdl: in getTypeDef: do not have schema for namespace http://www.w3.org/2001/XMLSchema 2010-12-16 20:55:27.246355 wsdl: in serializeType: returning: <nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg> 2010-12-16 20:55:27.246385 wsdl: in serializeType: returning: <nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote> 2010-12-16 20:55:27.246412 wsdl: serializeRPCParameters returning: <nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote> 2010-12-16 20:55:27.246459 nusoap_client: In serializeEnvelope length=626 body (max 1000 characters)=<nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote> style=document use=literal encodingStyle= 2010-12-16 20:55:27.246483 nusoap_client: headers: bool(false) 2010-12-16 20:55:27.246511 nusoap_client: namespaces: array(1) { ["ns3708"]=> string(18) "http://tempuri.org" } 2010-12-16 20:55:27.246559 nusoap_client: endpoint=https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx, soapAction=http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote, namespace=http://tempuri.org, style=document, use=literal, encodingStyle= 2010-12-16 20:55:27.246586 nusoap_client: SOAP message length=985 contents (max 1000 bytes)=<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3708="http://tempuri.org"><SOAP-ENV:Body><nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote></SOAP-ENV:Body></SOAP-ENV:Envelope> 2010-12-16 20:55:27.246621 nusoap_client: transporting via HTTP 2010-12-16 20:55:27.246988 nusoap_client: sending message, length=985 2010-12-16 20:55:27.246660 soap_transport_http: ctor url=https://homologacao.nfe.sefazvirtual.rs.gov.br/ws/nferecepcao/NfeRecepcao.asmx use_curl= curl_options: array(0) { } 2010-12-16 20:55:27.246697 soap_transport_http: parsed URL scheme = https 2010-12-16 20:55:27.246721 soap_transport_http: parsed URL host = homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:27.246743 soap_transport_http: parsed URL path = /ws/nferecepcao/NfeRecepcao.asmx 2010-12-16 20:55:27.246773 soap_transport_http: set header Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:27.246810 soap_transport_http: set header User-Agent: NuSOAP/0.7.3 (1.114) 2010-12-16 20:55:27.246841 soap_transport_http: set header Content-Type: text/xml; charset=UTF-8 2010-12-16 20:55:27.246869 soap_transport_http: set header SOAPAction: "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote" 2010-12-16 20:55:27.246898 soap_transport_http: setCredentials username= authtype=certificate digestRequest= array(0) { } 2010-12-16 20:55:27.246926 soap_transport_http: certRequest= array(6) { ["sslkeyfile"]=> string(65) "/Library/WebServer/Documents/nfephp_tutorial/certs/privatekey.pem" ["sslcertfile"]=> string(64) "/Library/WebServer/Documents/nfephp_tutorial/certs/publickey.pem" ["passphrase"]=> string(0) "" ["verifypeer"]=> bool(false) ["verifyhost"]=> bool(false) ["trace"]=> int(1) } 2010-12-16 20:55:27.246961 soap_transport_http: Authorization header not set for certificate 2010-12-16 20:55:27.247018 soap_transport_http: entered send() with data of length: 985 2010-12-16 20:55:27.247047 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme https, host homologacao.nfe.sefazvirtual.rs.gov.br, port 443 2010-12-16 20:55:27.247085 soap_transport_http: connect using cURL 2010-12-16 20:55:27.247129 soap_transport_http: setCurlOption option=10002, value= string(82) "https://homologacao.nfe.sefazvirtual.rs.gov.br:443/ws/nferecepcao/NfeRecepcao.asmx" 2010-12-16 20:55:27.247175 soap_transport_http: setCurlOption option=52, value= int(1) 2010-12-16 20:55:27.247206 soap_transport_http: setCurlOption option=42, value= int(1) 2010-12-16 20:55:27.247236 soap_transport_http: setCurlOption option=19913, value= int(1) 2010-12-16 20:55:27.247267 soap_transport_http: setCurlOption option=13, value= int(30) 2010-12-16 20:55:27.247296 soap_transport_http: set cURL SSL verify options 2010-12-16 20:55:27.247319 soap_transport_http: setCurlOption option=64, value= int(0) 2010-12-16 20:55:27.247349 soap_transport_http: setCurlOption option=81, value= int(0) 2010-12-16 20:55:27.247377 soap_transport_http: set cURL certificate options 2010-12-16 20:55:27.247403 soap_transport_http: setCurlOption option=64, value= bool(false) 2010-12-16 20:55:27.247434 soap_transport_http: setCurlOption option=81, value= bool(false) 2010-12-16 20:55:27.247465 soap_transport_http: setCurlOption option=10025, value= string(64) "/Library/WebServer/Documents/nfephp_tutorial/certs/publickey.pem" 2010-12-16 20:55:27.247498 soap_transport_http: setCurlOption option=10087, value= string(65) "/Library/WebServer/Documents/nfephp_tutorial/certs/privatekey.pem" 2010-12-16 20:55:27.247530 soap_transport_http: setCurlOption option=10026, value= string(0) "" 2010-12-16 20:55:27.247562 soap_transport_http: cURL connection set up 2010-12-16 20:55:27.247602 soap_transport_http: set header Content-Length: 985 2010-12-16 20:55:27.247628 soap_transport_http: HTTP request: POST /ws/nferecepcao/NfeRecepcao.asmx HTTP/1.0 2010-12-16 20:55:27.247653 soap_transport_http: HTTP header: Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:27.247677 soap_transport_http: HTTP header: User-Agent: NuSOAP/0.7.3 (1.114) 2010-12-16 20:55:27.247701 soap_transport_http: HTTP header: Content-Type: text/xml; charset=UTF-8 2010-12-16 20:55:27.247725 soap_transport_http: HTTP header: SOAPAction: "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote" 2010-12-16 20:55:27.247749 soap_transport_http: HTTP header: Content-Length: 985 2010-12-16 20:55:27.247780 soap_transport_http: Skip cURL header Host: homologacao.nfe.sefazvirtual.rs.gov.br 2010-12-16 20:55:27.247809 soap_transport_http: Skip cURL header Content-Length: 985 2010-12-16 20:55:27.247834 soap_transport_http: setCurlOption option=10023, value= array(3) { [0]=> string(32) "User-Agent: NuSOAP/0.7.3 (1.114)" [1]=> string(37) "Content-Type: text/xml; charset=UTF-8" [2]=> string(81) "SOAPAction: "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao/nfeRecepcaoLote"" } 2010-12-16 20:55:27.247870 soap_transport_http: set cURL HTTP headers 2010-12-16 20:55:27.247899 soap_transport_http: setCurlOption option=47, value= int(1) 2010-12-16 20:55:27.247930 soap_transport_http: setCurlOption option=10015, value= string(985) "<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3708="http://tempuri.org"><SOAP-ENV:Body><nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;cabecMsg versao=&quot;1.02&quot; xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot;&gt;&lt;versaoDados&gt;1.10&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns=&quot;http://www.portalfiscal.inf.br/nfe&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; versao=&quot;1.10&quot;&gt;&lt;idLote&gt;254&lt;/idLote&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote></SOAP-ENV:Body></SOAP-ENV:Envelope>" 2010-12-16 20:55:27.247962 soap_transport_http: set cURL POST data 2010-12-16 20:55:27.247984 soap_transport_http: set cURL payload 2010-12-16 20:55:27.248013 soap_transport_http: send and receive with cURL 2010-12-16 20:55:29.184928 soap_transport_http: No cURL error, closing cURL 2010-12-16 20:55:29.185516 soap_transport_http: found proper separation of headers and document 2010-12-16 20:55:29.185550 soap_transport_http: cleaned data, stringlen: 767 2010-12-16 20:55:29.185628 soap_transport_http: No Content-Encoding header 2010-12-16 20:55:29.185658 soap_transport_http: end of send() 2010-12-16 20:55:29.185708 nusoap_client: got response, length=767 type=text/xml; charset=utf-8 2010-12-16 20:55:29.185741 nusoap_client: Entering parseResponse() for data of length 767 headers: array(7) { ["date"]=> string(29) "Thu, 16 Dec 2010 22:55:29 GMT" ["server"]=> string(17) "Microsoft-IIS/6.0" ["x-powered-by"]=> string(7) "ASP.NET" ["x-aspnet-version"]=> string(9) "2.0.50727" ["cache-control"]=> string(18) "private, max-age=0" ["content-type"]=> string(23) "text/xml; charset=utf-8" ["content-length"]=> string(3) "767" } 2010-12-16 20:55:29.185794 nusoap_client: Got response encoding: utf-8 2010-12-16 20:55:29.185829 nusoap_client: Use encoding: UTF-8 when creating nusoap_parser 2010-12-16 20:55:29.185915 nusoap_parser: Charset from HTTP Content-Type matches encoding from XML declaration 2010-12-16 20:55:29.185942 nusoap_parser: Entering nusoap_parser(), length=767, encoding=UTF-8 2010-12-16 20:55:29.186142 nusoap_parser: found root struct nfeRecepcaoLoteResponse, pos 2 2010-12-16 20:55:29.186478 nusoap_parser: in buildVal() for nfeRecepcaoLoteResponse(pos 2) of type struct 2010-12-16 20:55:29.186506 nusoap_parser: in buildVal, there are children 2010-12-16 20:55:29.186538 nusoap_parser: in buildVal, adding Java Vector or generic compound type nfeRecepcaoLoteResponse 2010-12-16 20:55:29.186575 nusoap_parser: in buildVal, return: array(1) { ["nfeRecepcaoLoteResult"]=> &string(285) "<?xml version="1.0" encoding="utf-8"?><retEnviNFe versao="1.10" xmlns="http://www.portalfiscal.inf.br/nfe"><tpAmb>2</tpAmb><verAplic>SVRS20100210155347</verAplic><cStat>226</cStat><xMotivo>Rejeicao: Codigo da UF do Emitente diverge da UF autorizadora</xMotivo><cUF>0</cUF></retEnviNFe>" } 2010-12-16 20:55:29.186646 nusoap_parser: parsed successfully, found root struct: 2 of name nfeRecepcaoLoteResponse 2010-12-16 20:55:29.186735 nusoap_client: sent message successfully and got a(n) array return=array(1) { ["nfeRecepcaoLoteResult"]=> string(285) "<?xml version="1.0" encoding="utf-8"?><retEnviNFe versao="1.10" xmlns="http://www.portalfiscal.inf.br/nfe"><tpAmb>2</tpAmb><verAplic>SVRS20100210155347</verAplic><cStat>226</cStat><xMotivo>Rejeicao: Codigo da UF do Emitente diverge da UF autorizadora</xMotivo><cUF>0</cUF></retEnviNFe>" } FALHA no envio !! cStat : 226Motivo : Rejeicao: Codigo da UF do Emitente diverge da UF autorizadora

Roberto Leite Machado

unread,
Dec 17, 2010, 4:51:56 AM12/17/10
to nfe...@googlegroups.com
Não basta conferir a tag cUF , tem que conferir UF, ID etc..

Roberto

2010/12/16 Bernardo Hoehl <bern...@correiofacil.com>

FerreiraH.

unread,
Dec 17, 2010, 5:34:30 AM12/17/10
to nfe...@googlegroups.com
Pelo que vi voce esta enviando para o RS ?
No retorno o codigo do estado volta vazio
so descobri que voce esta enviando um pedido de retorno de lote 256
não encontrei na mensagem para qual codigo de estado voce enviou

2010/12/17 Roberto Leite Machado <roberto...@superig.com.br>

Bernardo Hoehl

unread,
Dec 17, 2010, 7:35:49 AM12/17/10
to nfe...@googlegroups.com
Bom dia Ferreira e amigos,

Obrigado pelo interesse.

On 17.12.2010, at 8:34 AM, FerreiraH. wrote:

so descobri que voce esta enviando um pedido de retorno de lote 256 
não encontrei na mensagem para qual codigo de estado voce enviou

Basicamente o que fiz foi o seguinte:

1) Peguei o pacote NFePHP para download e editei o config.php com meus dados. UF=33  (Rio de Janeiro)

2) Eu editei o arquivo enviaNFe.php que fica na pasta "exemplos", mudando o nº da NFe que vem junto com o download do nfephp, que é a nfe Nº 3345, para o nº 256 que é o número da NFe que tento enviar, e mudei o path para o nome correto do xml que gerei a partir de um TXT editado por mim.

E por final consigo gerar o XML a partir do TXT, assinar, mas não consigo enviar.

Eu me recordo ter visto este erro "Codigo da UF do Emitente diverge da UF autorizadora" muitas vezes quando estava tentando usar o nfePHP pela primeira vez. Mas como eu tinha meu amigo Rogério, programador em PHP,  me ajudando, não lembro mais como resolvemos.

Ontem perguntei ele, e tão pouco se lembra.

Olhei numa versão que tenho aqui do ToolsNfe e peguei a linha comentada que força o print to soapDebug, e aí consegui alguma informação, como postei ontem.

Como já disse, tenho uma biblioteca tools modificada pelo Rogério, que envia uma NFe de cada vez, e, é funcional.

Mas ao fazer o tutorial, estou tentando fazer do mesmo jeito que alguém faria pela primeira vez, e daí a minha dificuldade.

Imagino que devo ser capaz de fazer o nfePHP funcionar seguindo meu tutorial, ou o tutorial não tem sentido.

Basicamente, editei o config.php, que é correto, conferido dezenas de vezes, gerei um TXT que gera um xml e depois de assinado passa Ok no verificador de mensagens do Sefaz, e tento enviar fazendo uma requisição em exemplos/enviaNFe.php.

Pergunta: Estou esquecendo algo? Deixei de informar minha UF em algum lugar?

Obrigado,


Bernardo

Bernardo Hoehl

unread,
Dec 17, 2010, 7:39:46 AM12/17/10
to nfe...@googlegroups.com
Em anexo o XML que tento enviar...

33101273264202000114550010000002547243551000-nfe.xml

FerreiraH.

unread,
Dec 17, 2010, 12:22:06 PM12/17/10
to nfe...@googlegroups.com
Esta tua dificuldade é a dificuldade que todo mundo tem quando começa.
Todo mundo precisa lembrar de editar o arquivo que tem o numero do lote para reiniciar de 0 ou 1
Precisa verificar dentro do config o codigo da uf
Parece que o XML esta correto.
Observei que o endereço do sefaz que voce esta utilizando é RS o rio não tem um sefaz proprio ?

nesta linha o aplicativo busca os dados para endereçar o soap
            //carregar a matriz com os dados para acesso aos WebServices SEFAZ
            $this->aURL = $this->loadSEFAZ( $P_ROOT . 'config/urlWebServicesNFe.xml',$sAmb,$this->UF);
Veja em sua aplicação qual o conteudo deste $this->UF;



Em 17 de dezembro de 2010 10:39, Bernardo Hoehl <bern...@correiofacil.com> escreveu:
Em anexo o XML que tento enviar...


Bernardo Hoehl

unread,
Dec 17, 2010, 12:26:42 PM12/17/10
to nfe...@googlegroups.com
Vergonha cara...

Mas o Rio usa do RS...

Bernardo Hoehl

unread,
Dec 17, 2010, 12:33:51 PM12/17/10
to nfe...@googlegroups.com
Ferreira,


Buscando dentro do arquivo ToolsNFePHP.class.php pela string "":

Eu encontro:

1) $this->UF=$UF;

2) //carregar a matriz com os dados para acesso aos WebServices SEFAZ
            $this->aURL = $this->loadSEFAZ( $P_ROOT . 'config/urlWebServicesNFe.xml',$sAmb,$this->UF);

Creio que o item 1) quer dizer que minha UF é uma variável de nome $UF, assim imagino que esta variável deve estar declarada antes, encontro isso aqui:

     * @var <type>
     */
    private $UF='';
    /**

Deveria eu editar o ToolsNFePHP.class.php???


Obrigado,


Bernardo

===================================


On 17.12.2010, at 3:22 PM, FerreiraH. wrote:

Bernardo Hoehl

unread,
Dec 17, 2010, 12:35:41 PM12/17/10
to nfe...@googlegroups.com
Ferreira,


Buscando dentro do arquivo ToolsNFePHP.class.php pela string "$this->UF":

Eu encontro:

1) $this->UF=$UF;

2) //carregar a matriz com os dados para acesso aos WebServices SEFAZ
            $this->aURL = $this->loadSEFAZ( $P_ROOT . 'config/urlWebServicesNFe.xml',$sAmb,$this->UF);

Creio que o item 1) quer dizer que minha UF é uma variável de nome $UF, assim imagino que esta variável deve estar declarada antes, encontro isso aqui:

     * @var <type>
     */
    private $UF='';
    /**

Deveria eu editar o ToolsNFePHP.class.php???


Obrigado,


Bernardo

===================================
On 17.12.2010, at 3:22 PM, FerreiraH. wrote:

FerreiraH.

unread,
Dec 18, 2010, 4:12:01 PM12/18/10
to nfe...@googlegroups.com
Eu encontro:

1) $this->UF=$UF;

Quando voce carrega o tools ele inclui o config e dentro do config deveria ter a $UF
ok eu queria que voce fizesse era dar um echo

mandar imprimir com echo o valor da variavel $UF  depois pois esta variavel busca o endereço do webservice para o toolçs  aqui

 $this->aURL = $this->loadSEFAZ( $P_ROOT . 'config/urlWebServicesNFe.xml',$sAmb,$this->UF);

quando voce chama a função loadsefaz um dos parametros é o UF que voce colocou no arquivo config.
Voce disse que este erro já tinha ocorrido antes

tente utilizar o arquivo

/config/urlWebServicesNFe.xml da sua instalação que esta funcionando.

Bernardo Hoehl

unread,
Dec 18, 2010, 4:19:36 PM12/18/10
to nfe...@googlegroups.com
Tudo bem.

Mas eu queria fazer do zero, como uma pessoa faria quando baixa nfePhp e tenta usar pela primeira vez.

Entende?

FerreiraH.

unread,
Dec 18, 2010, 4:33:03 PM12/18/10
to nfe...@googlegroups.com
Assim (é uma sujestão para voce cercar o erro )
é que pode ser que exista um erro naquele arquivo.
se corrigir precisa avisar o Roberto para arrumar.(Como sei que ele esta muito ocupado vai demorar )
Se for um erro pequeno voce coloca no tuto tem um erro aqui corrija assim.

Bernardo Hoehl

unread,
Dec 18, 2010, 5:38:19 PM12/18/10
to nfe...@googlegroups.com
Ferreira,


Me faz um favor. Me manda uma copia  do ToolsNfeClass.php que você está usando. 

O meu é todo modificado para enviar um XML de cada vez. 

Vou testar com o seu. Aí posso saber se o problema está na biblioteca que baixei. 

Atenciosamente,


Bernardo Höhl

FerreiraH.

unread,
Dec 18, 2010, 8:07:24 PM12/18/10
to nfe...@googlegroups.com
Bernardo o meu tambem esta mexido
Hoje vevifiquei no assembla a versão de lá da 1.1 é 190
Vou verificar se com ela por aqui consigo fazer funcionar

Bernardo Hoehl

unread,
Dec 20, 2010, 9:02:26 AM12/20/10
to nfe...@googlegroups.com
Amigos,


O erro "FALHA no envio !! cStat : 226Motivo : Rejeicao: Codigo da UF do Emitente diverge da UF autorizadora"

Se deve ao fato do arquivo "exemplos/enviaNFe.php" no pacote baixado do site do nfePhp estar bichado...

Da forma que o pacote é baixado, para quem não conhece PHP a fundo, não consegue usá-lo.

Os arquivos funcionais, encontrei numa pasta antiga que tinha, que eu e meu amigo Rogério, programador em PHP geramos ainda no início quando tentavamos usar o nfePhp.

Tenho um arquivo aqui funcional, que se chama enviaNF.php (sem o "e" em nfe) e consultaNF.php.

Para ser sincero, não sei se são de autoria do Rogério, ou se algum amigo do grupo me cedeu.

Mas o tutorial só poderá ir a frente se eu mudar o pacote oferecido para download.

Vou postar nova mensagem com pedido.

Obrigado!


Bernardo

Conteudo dos arquivos mencionados acima:

enviaNF.php:

<?php
//assina todas as NFe na pasta entradas e as move para a pasta assinadas
//error_reporting(0);
require_once('libs/ToolsNFePHP.class.php');
$nfe = new ToolsNFePHP;
$nfe->loadCerts();
$aRet=$nfe->autoSendNFe();

print_r($aRet);

?>


consultaNF.php:


<?php
//assina todas as NFe na pasta entradas e as move para a pasta assinadas
error_reporting(0);
require_once('libs/ToolsNFePHP.class.php');
$nfe = new ToolsNFePHP;
$nfe->loadCerts();
$aRet=$nfe->autoAuthNFe();

print_r($aRet);


?>.

arquivo bichado: enviaNFe.php:

<?php
//envia a NFe, lembre que este é apenas um exemplo de uso
//não USE,  não EXECUTE pois não vai funcionar !!! serão acusados erros
//crie sua própria NFe uma que ainda não tenha sido enviada ao SEFAZ
//USE somente o ambiente de homologação para fazer testes !!!

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

$nfe = new ToolsNFePHP;
$arqxml = '_homologacao/validadas/33101273264202000114550010000002570700618572-nfe.xml';

if ( is_file($arqxml) ) {
    $nfefile = file_get_contents($arqxml);
    $num = '254'; //usei o numero da NF como id do lote este numero pode ser extraido diretamente do nome desse arquivo
    //enviar as notas
    if ($ret = $nfe->sendLot($nfefile,$num)){
        if ($ret['status']) {
            echo "SUCESSO !! " . $ret['cStat'] . "Motivo : " . $ret['xMotivo'] . "<BR>Aguarde alguns segundos e consulte a situação da NFe <BR>";
        } else {
            echo "FALHA no envio !! cStat : " . $ret['cStat'] . "Motivo : " . $ret['xMotivo'] . "<BR>";
        }
    } else {
        echo "FALHA no metodo de envio !!!!";
    }
} else {
    echo "Arquivo não encontrado !!";

}
?>
Reply all
Reply to author
Forward
0 new messages