Nfe 3.10 webservice MG

Asked

Viewed 789 times

1

I am performing Nfe 3.10 tests for MG, the web service for authorization is different and expects an object of type nfeDadosMsg that has an array of Nfe. In the others I always sent an Xmlnode with the whole batch, already in MG I put each note in a position of the array, however as I do to send the Idlote as it is in MG?

  • 1

    Behold Here, Here and Here with example attached @Danilo

  • It doesn’t help, again "MG I put each note in a position of the array, but how do I send the Idlot as it is"

  • I have not yet tested by sending more than one note, make the code snippet or source available for a better analysis. @Danilo

1 answer

1


The solution was to create the webservice class in hand, another dev had created, so:

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

Browser other questions tagged

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