Sefaz Webservice status in PHP

Asked

Viewed 260 times

0

Can anyone tell why this query script returns nothing (neither error nor response)? Grateful!

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();
}
  • And the server log says something?

  • PHP errors are active on your server ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.