Ir para conteúdo

JOSELUISALD

Members
  • Total de itens

    10
  • Registro em

  • Última visita

Posts postados por JOSELUISALD


  1. Bom dia. Estou tentando consultar os serviços da Sefaz RS e não estou conseguindo. Sempre da rejeição. Sou novo nos webservices, e quero aprender o que for preciso para montar meu próprio emissor do zero.


           Código:

    $local_cert = 'Certificado.pem';
            $passwd = '1234';
            $ws = 'https://nfe-homologacao.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx?wsdl';  
            $endpoint = 'https://nfe-homologacao.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx';  
                         
            $options = array
            (
                'location' => $endpoint,
                'keep_alive' => true,
                'trace' => true,
                'local_cert' => $local_cert,
                'passphrase' => $passwd,
                'cache_wsdl' => WSDL_CACHE_NONE,
                'soap_version' => SOAP_1_2
            );    
    
            $client = new SoapClient($ws, $options);
            $function = 'nfeStatusServicoNF';
    
            $options = [];
            $arguments['consStatServ'] = '';
            $arguments['nfeDadosMsg'] = array('xServ' => 'STATUS', 'cUF' => '43', 'tpAmb' => '2', 'versao' => 'RS201805211008');
    
            $result = $client->__soapCall($function, $arguments, $options);
            $functions = $client->__getFunctions();
    
            header("Content-type: text/xml");
            echo $result->any;

    Erro:

    <retConsStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00">
    <tpAmb>2</tpAmb>
    <verAplic>RS201805211008</verAplic>
    <cStat>225</cStat>
    <xMotivo>Rejeicao: Falha no Schema XML do lote de NFe</xMotivo>
    <cUF/>
    <dhRecbto>2019-11-29T10:18:08-03:00</dhRecbto>
    </retConsStatServ>

     Tentei assim também:

     

    $local_cert = 'Certificado.pem';
    		$passwd = '1234';
    		$ws = 'https://nfe-homologacao.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx?wsdl';  
    		$endpoint = 'https://nfe-homologacao.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx';  
    		   		  
    		$options = array
    		(
    			'location' => $endpoint,
    			'keep_alive' => true,
    			'trace' => true,
    			'local_cert' => $local_cert,
    			'passphrase' => $passwd,
    			'cache_wsdl' => WSDL_CACHE_NONE,
    			'soap_version' => SOAP_1_2
    		);	
    
    		$client = new SoapClient($ws, $options);
    		$function = 'nfeStatusServicoNF';
    
    		$nfeDadosMsg = 
    		'<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00">
    			<xServ>STATUS</xServ>
    			<cUF>43</cUF>
    			<tpAmb>2</tpAmb>
    		</consStatServ>';
    
    		$nfeCabecMsg = '<versao>4.0</versao>';
    
    		$options = [];
    		$arguments['nfeDadosMsg'] = $nfeDadosMsg;
    		$arguments['nfeCabecMsg'] = $nfeCabecMsg;
    
    		$result = $client->__soapCall($function, $arguments, $options);
    		$functions = $client->__getFunctions();
    
    		header("Content-type: text/xml");
    		echo $result->any;

     

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.