Status Webservice Sefaz in PHP

0

Does anyone know why this query script returns nothing (neither error nor response)? Thanks!

try {

    $wsdl = 'https://mdfe-homologacao.svrs.rs.gov.br/ws/MDFeStatusServico/MDFeStatusServico.asmx?wsdl';
    $function = 'mdfeStatusServicoMDF';

    $cabec = '<mdfeCabecMsg xmlns="http://www.portalfiscal.inf.br/wsdl/MdfeRecepcao">';
    $cabec .= '<cUF>RJ</cUF><versaoDados>3.00</versaoDados></mdfeCabecMsg>';

    $dados = '<mdfeDadosMsg xmlns="http://www.portalfiscal.inf.br/wsdl/MdfeRecepcao">';
    $dados .= '<consStatServMDFe xmlns="http://www.portalfiscal.inf.br">';
    $dados .= '<versao>3.00</versao><tpAmb>2</tpAmb><xServ>STATUS</xServ></consStatServMDFe></mdfeDadosMsg>';

    // $cert = 'chDigital/cert.pfx';

    $client = new SoapClient($wsdl);
    $err = $client->getError();
    if ($err) {
        echo '<h2>Erro SOAP: </h2>' . $err;
    } else {
        echo 'Ok....';  
    }

    /*
    $arguments= array($function => array(
       'versao' => '3.00',
       'tpAmb' => '2',
       'xServ'  => 'STATUS'
    ));
    */

    $result = $client->__soapCall($function, $dados, $cabec);
    echo 'Response: ';
    echo $result;

} catch (Exception $e) {
    echo $e->getMessage();
}
    
asked by anonymous 08.10.2018 / 22:31

0 answers