NFe 3.10 webservice MG

1

I am testing NFe 3.10 for MG, the webservice for authorization is different and expects an object of type nfeDadosMsg that has an NFe array. In the others I always send an XmlNode with the whole lot, already in MG I put each note in an array position, however how do I send the IdLote like this in MG?

    
asked by anonymous 05.03.2015 / 20:50

1 answer

1

The solution was to create the webservice class in hand, another dev had created, it looks like this:

public partial class nfeCabecMsg : SoapHeader
{
    private string _cUF;

    public string cUF
    {
        get { return _cUF; }
        set { _cUF = value; }
    }
    private string _versaoDados;

    public string versaoDados
    {
        get { return _versaoDados; }
        set { _versaoDados = value; }
    }
}

[WebServiceBindingAttribute(Name = "NfeRetAutorizacaoSoap12", Namespace = "http://www.portalfiscal.inf.br/nfe/wsdl/NfeRetAutorizacao")]
public partial class NfeRetAutorizacao : System.Web.Services.Protocols.SoapHttpClientProtocol
{

    private nfeCabecMsg nfeCabecMsgValueField;

    private bool useDefaultCredentialsSetExplicitly;

    /// <remarks/>
    public NfeRetAutorizacao()
    {
        this.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
        this.Url = global::Skill.T10.NFe.Properties.Settings.Default.Skill_T10_NFe_wsMGPRetAutorizacao_NfeRetAutorizacao;
        if ((this.IsLocalFileSystemWebService(this.Url) == true))
        {
            this.UseDefaultCredentials = true;
            this.useDefaultCredentialsSetExplicitly = false;
        }
        else
        {
            this.useDefaultCredentialsSetExplicitly = true;
        }
    }

    public nfeCabecMsg nfeCabecMsgValue
    {
        get
        {
            return this.nfeCabecMsgValueField;
        }
        set
        {
            this.nfeCabecMsgValueField = value;
        }
    }

    public new string Url
    {
        get
        {
            return base.Url;
        }
        set
        {
            if ((((this.IsLocalFileSystemWebService(base.Url) == true)
                        && (this.useDefaultCredentialsSetExplicitly == false))
                        && (this.IsLocalFileSystemWebService(value) == false)))
            {
                base.UseDefaultCredentials = false;
            }
            base.Url = value;
        }
    }

    public new bool UseDefaultCredentials
    {
        get
        {
            return base.UseDefaultCredentials;
        }
        set
        {
            base.UseDefaultCredentials = value;
            this.useDefaultCredentialsSetExplicitly = true;
        }
    }


    private bool IsLocalFileSystemWebService(string url)
    {
        if (((url == null)
                    || (url == string.Empty)))
        {
            return false;
        }
        System.Uri wsUri = new System.Uri(url);
        if (((wsUri.Port >= 1024)
                    && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0)))
        {
            return true;
        }
        return false;
    }

    [SoapHeaderAttribute("nfeCabecMsgValue", Direction = SoapHeaderDirection.InOut)]
    [SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeRetAutorizacao/nfeRetAutorizacaoLote", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
    public XmlNode nfeRetAutorizacaoLote(XmlNode nfeDadosMsg)
    {
        XmlNode _retorno = null;

        object[] results = this.Invoke("nfeRetAutorizacaoLote", new object[] { nfeDadosMsg });

        _retorno = (System.Xml.XmlNode)(results[0]);


        return (_retorno);
    }
}
    
12.03.2015 / 21:16