Problema para Verificar Status Serviço NFe versão 2.00

3 respostas
P

Estou com problemas para acessar os ambientes da versao 2.00

Já tenho um sistema de NFe da versao 1.10 e funciona há 2 anos. Mas não consigo nem verificar o status do serviço na versao 2.00. Retorna sempre: retConsStatServ: null
O mesmo acontece para os outros serviços: Envio de Lote, Cancelamento, etc
Na versao 1.10, eu passava o Cabeçalho e a mensgaem como 2 strings. Mas nessa nova versao, exige apenas um objeto do tipo: NfeDadosMsg.
Alguém pode me ajudar? aqui está um trecho do codigo que estou utilizando:

NfeStatusServico2Hom service = new NfeStatusServico2Hom();
                NfeStatusServico2Soap12Hom nfeStatus = service.getNfeStatusServicoServicePort();
                NfeCabecMsg ncm = new NfeCabecMsg();
                ncm.setCUF("41");
                ncm.setVersaoDados("2.00");
                NfeDadosMsg ndm = new NfeDadosMsg();
                ndm.getContent().add(nfeDadosMsg);
                NfeStatusServicoNF2Result result = nfeStatus.nfeStatusServicoNF2(ndm);

Deve estar faltando passar algum parametro. Mas não consigo descobrir o que é!

3 Respostas

R

Boa noite galera,

Para não criar outro tópico estou reativando este, pois estou passando pelo mesmo problema do colega acima.

NfeStatusServico2 servico = new NfeStatusServico2();
NfeStatusServico2Soap12 ws = servico.getNfeStatusServico2Soap12();
ObjectFactory factory = new ObjectFactory();
NfeDadosMsg dados = factory.createNfeDadosMsg();
ConsStatServ stats = new br.inf.portalfiscal.nfe.status.ObjectFactory().createTConsStatServ();
stats.setCUF("35");
stats.setTpAmb("2");
stats.setVersao("2.00");
stats.setXServ("STATUS");
dados.getContent().add(stats);
NfeCabecMsg cabec = factory.createNfeCabecMsg();
cabec.setCUF("35");
cabec.setVersaoDados("2.00");
NfeStatusServicoNF2Result resultado = ws.nfeStatusServicoNF2(dados, new Holder<NfeCabecMsg>(cabec));
System.out.println("Resposta do servico: " + resultado.getContent().toString());

Alguem sabe porque sempre está retornando “Resposta do servico: [[retConsStatServ: null]]”?

Estou ativando a propriedade “com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump” e assim eu vejo que o xml está sendo retornado pela SEFAZ, porém não consigo pegá-lo na resposta

System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");

Vc conseguiu solucionar o problema na época???

[]'s

aix

postei aqui a solução com o JAX, poré o status do serviço é o máximo que vai conseguir com ele. precisei uconsumir usando soap mesmo.

R

Eu já vi várias vezes este tópico que vc me mandou. Ele já me foi muito util para conseguir importar as classes com o wsimport. Porém o erro que eu estou passando é o seguinte:
Meu serviço está retornando um objeto deste tipo NfeStatusServicoNF2Result (gerado pelo wsimport):

package br.inf.portalfiscal.nfe.wsdl.nfestatusservico2;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;any/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "content"
})
@XmlRootElement(name = "nfeStatusServicoNF2Result")
public class NfeStatusServicoNF2Result {

    @XmlMixed
    @XmlAnyElement(lax = true)
    protected List<Object> content;

    /**
     * Gets the value of the content property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the content property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getContent().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link String }
     * {@link Object }
     * 
     * 
     */
    public List<Object> getContent() {
        if (content == null) {
            content = new ArrayList<Object>();
        }
        return this.content;
    }

}

Dentro do atributo content, tem um objeto do tipo RetConsStatServ. Porém este objeto só está vindo com o atributo (campo versao) preechido, todos os outros campos estão vindo null.

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2012.02.16 at 09:30:33 AM GMT-03:00 
//


package br.inf.portalfiscal.nfe.status;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;


/**
 * Tipo Resultado da Consulta do Status do Serviço
 * 
 * <p>Java class for TRetConsStatServ complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="TRetConsStatServ">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="tpAmb" type="{http://www.portalfiscal.inf.br/nfe}TAmb"/>
 *         &lt;element name="verAplic" type="{http://www.portalfiscal.inf.br/nfe}TVerAplic"/>
 *         &lt;element name="cStat" type="{http://www.portalfiscal.inf.br/nfe}TStat"/>
 *         &lt;element name="xMotivo" type="{http://www.portalfiscal.inf.br/nfe}TMotivo"/>
 *         &lt;element name="cUF" type="{http://www.portalfiscal.inf.br/nfe}TCodUfIBGE"/>
 *         &lt;element name="dhRecbto" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         &lt;element name="tMed" type="{http://www.portalfiscal.inf.br/nfe}TMed" minOccurs="0"/>
 *         &lt;element name="dhRetorno" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         &lt;element name="xObs" type="{http://www.portalfiscal.inf.br/nfe}TMotivo" minOccurs="0"/>
 *       &lt;/sequence>
 *       &lt;attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/nfe}TVerConsStatServ" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlRootElement(name= "retConsStatServ", namespace = "http://www.portalfiscal.inf.br/nfe")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "retConsStatServ", propOrder = {
    "tpAmb",
    "verAplic",
    "cStat",
    "xMotivo",
    "cuf",
    "dhRecbto",
    "tMed",
    "dhRetorno",
    "xObs"
})
public class RetConsStatServ {

    @XmlElement(required = true)
    protected String tpAmb;
    @XmlElement(required = true)
    protected String verAplic;
    @XmlElement(required = true)
    protected String cStat;
    @XmlElement(required = true)
    protected String xMotivo;
    @XmlElement(name = "cUF", required = true)
    protected String cuf;
    @XmlElement(required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar dhRecbto;
    protected String tMed;
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar dhRetorno;
    protected String xObs;
    @XmlAttribute(required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String versao;

    /**
     * Gets the value of the tpAmb property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getTpAmb() {
        return tpAmb;
    }

    /**
     * Sets the value of the tpAmb property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setTpAmb(String value) {
        this.tpAmb = value;
    }

    /**
     * Gets the value of the verAplic property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getVerAplic() {
        return verAplic;
    }

    /**
     * Sets the value of the verAplic property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setVerAplic(String value) {
        this.verAplic = value;
    }

    /**
     * Gets the value of the cStat property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCStat() {
        return cStat;
    }

    /**
     * Sets the value of the cStat property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCStat(String value) {
        this.cStat = value;
    }

    /**
     * Gets the value of the xMotivo property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getXMotivo() {
        return xMotivo;
    }

    /**
     * Sets the value of the xMotivo property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setXMotivo(String value) {
        this.xMotivo = value;
    }

    /**
     * Gets the value of the cuf property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCUF() {
        return cuf;
    }

    /**
     * Sets the value of the cuf property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCUF(String value) {
        this.cuf = value;
    }

    /**
     * Gets the value of the dhRecbto property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getDhRecbto() {
        return dhRecbto;
    }

    /**
     * Sets the value of the dhRecbto property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setDhRecbto(XMLGregorianCalendar value) {
        this.dhRecbto = value;
    }

    /**
     * Gets the value of the tMed property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getTMed() {
        return tMed;
    }

    /**
     * Sets the value of the tMed property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setTMed(String value) {
        this.tMed = value;
    }

    /**
     * Gets the value of the dhRetorno property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getDhRetorno() {
        return dhRetorno;
    }

    /**
     * Sets the value of the dhRetorno property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setDhRetorno(XMLGregorianCalendar value) {
        this.dhRetorno = value;
    }

    /**
     * Gets the value of the xObs property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getXObs() {
        return xObs;
    }

    /**
     * Sets the value of the xObs property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setXObs(String value) {
        this.xObs = value;
    }

    /**
     * Gets the value of the versao property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getVersao() {
        return versao;
    }

    /**
     * Sets the value of the versao property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setVersao(String value) {
        this.versao = value;
    }

}

Eu fiz os testes ativando o dump da transação e assim eu sei que o xml está chegando corretamente pra mim.
Alguem já passou por este problema? Ou alguem tem alguma noção do que pode ser o problema?

Criado 15 de março de 2011
Ultima resposta 17 de fev. de 2012
Respostas 3
Participantes 3