1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Status Webservice Sefaz em PHP

Discussion in 'Technology' started by Fabio Martins, Oct 8, 2018.

  1. Alguém sabe dizer porquê este script de consulta não retorna nada (nem erro e nem resposta)? Grato!

    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();
    }

    Login To add answer/comment
     

Share This Page