none
Como baixar XML de NFe via web service RRS feed

  • Pergunta

  • Olá boa tarde

    Amigos,

    Estou iniciando agora com NFe e já tenho uma tarefa para fazer, tenho que a partir do web service fornecido pela sefaz baixar os XML das NFes existentes pelo utilizando o certificado digital, até agora achei alguns exemplo somente sobre consultas de serviço e etc, gostaria de uma ajuda com esse problema se possível.

    Att,

    Bruno Pardim.

    terça-feira, 2 de dezembro de 2014 18:26

Respostas

  • Bruno

         Não sei se você conseguiu alguma coisa, mais no momento estou também neste processo de desenvolvimento  ( Consulta de Status de Web Service - NFe), veja até onde cheguei, mais estou com o seguinte erro de retorno, caso você saiba, ou consiga algo a mais basta dar um alô.

    242 - Rejeição: Cabeçalho - Falha no Schema XML


    <retConsStatServ versao="2.00" xmlns="http://www.portalfiscal.inf.br/nfe">
    <tpAmb>1</tpAmb>
    <verAplic>SP_NFE_PL_006q</verAplic>
    <cStat>242</cStat>
    <xMotivo>Rejeição: Cabeçalho - Falha no Schema XML</xMotivo>
    <cUF>35</cUF>
    <dhRecbto>2014-12-01T12:59:47</dhRecbto>
    </retConsStatServ>

    xml do Cabeçario

    <?xml version="1.0" encoding="UTF-8"?>
    <nfeCabecMsg versao="2.00" xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2">
    <versaoDados>2.00</versaoDados>
    <cUF>SP</cUF>
    </nfeCabecMsg>

    **********************************

    Private Sub btn_Processa_Click(sender As System.Object, e As System.EventArgs) Handles btn_Processa.Click

          Try

            Dim cl_Consulta_Status As New NFe_Statusxa1.NFeStatusxa1

             cl_Consulta_Status.Consulta_Statusxa1()

          Catch ex As Exception

          End Try

       End Sub

    **********************************

    Imports System.Xml

    Imports System.Security

    Imports System.Security.Cryptography

    Imports System.Security.Cryptography.X509Certificates

    Imports System.Windows.Forms

    Imports System.Globalization

    Imports nfelib.ws_nfeStatusa1

    Imports System.Text

    Namespace NFe_Statusxa1

       Public Class NFeStatusxa1

          Public Sub Consulta_Statusxa1()

             Dim result As XmlNode = Nothing

             Try

                Dim cert As X509Certificate2 = SelecionarCertificadox()

                Dim xmlns As New Serialization.XmlSerializerNamespaces

                Dim xmlDados As New XmlDocument

                Dim xmlCab As New XmlDocument

                Dim nfeStatusServ As New NfeStatusServico2a1

                nfeStatusServ.ClientCertificates.Add(cert)

                Dim ds_Versao As String = "2.00"

                Dim ic_Ambiente As Integer = 1

                Dim ds_UF As String = "SP"

                Dim id_UF As Integer = 35

                'xmlCab.LoadXml("<?xml version=""1.0"" encoding=""UTF-8""?><nfeCabecMsg xmlns=""http://www.portalfiscal.inf.br/nfe"" versao=""2.00""><versaoDados>2.00</versaoDados><cUF>35</cUF></nfeCabecMsg>")

                Dim xmlConsulta1 As New StringBuilder()

                xmlConsulta1.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")

                xmlConsulta1.Append("<nfeCabecMsg versao=""2.00"" xmlns=""http://www.portalfiscal.inf.br/nfe"">")

                xmlConsulta1.Append("<versaoDados>" + ds_Versao.ToString + "</versaoDados>")

                xmlConsulta1.Append("<cUF>" + ds_UF + "</cUF>")

                xmlConsulta1.Append("</nfeCabecMsg>")

                xmlCab.LoadXml(xmlConsulta1.ToString)

                'xmlDados.LoadXml("<?xml version=""1.0"" encoding=""utf-8""?><consStatServ xmlns=""http://www.portalfiscal.inf.br/nfe"" versao=""2.00""><tpAmb>1</tpAmb><cUF>35</cUF><xServ>STATUS</xServ></consStatServ>")

                Dim xmlConsulta2 As New StringBuilder()

                xmlConsulta2.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")

                xmlConsulta2.Append("<consStatServ versao=""2.00"" xmlns=""http://www.portalfiscal.inf.br/nfe"">")

                xmlConsulta2.Append("<tpAmb>" + ic_Ambiente.ToString + "</tpAmb>")

                xmlConsulta2.Append("<cUF>" + id_UF.ToString + "</cUF>")

                xmlConsulta2.Append("<xServ>STATUS</xServ>")

                xmlConsulta2.Append("</consStatServ>")

                xmlDados.LoadXml(xmlConsulta2.ToString)

                result = nfeStatusServ.nfeStatusServicoNF2(xmlCab, xmlDados)

                Dim cTeste As String = String.Empty

                cTeste = "ok"

                Console.WriteLine(result.OuterXml)

                Console.Read()

                MsgBox(result.OuterXml)

             Catch ex As Exception

                MsgBox(result.OuterXml)

             End Try

          End Sub

          Public Shared Function SelecionarCertificadox() As X509Certificate2

             'Listando certificados

             Dim store As New X509Store(StoreName.My)

             store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)

             Dim validCertificates As X509Certificate2Collection = store.Certificates.Find(X509FindType.FindByTimeValid, Now, True)

             If validCertificates.Count <= 0 Then Return Nothing

             Dim selected As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(validCertificates, "Selecione um certificado", "", X509SelectionFlag.SingleSelection)

             If selected.Count > 0 Then

                IO.File.AppendAllText("certificate.selection.log", Now.ToString("[yyyy-MM-dd HH:mm:ss]") & "Last public key selected: " & vbNewLine & selected(0).GetPublicKeyString & vbNewLine)

                Return selected(0)

             End If

             Return Nothing

          End Function

       End Class

    End Namespace

    **********************************

    Option Strict On

    Option Explicit On

    Imports System.ComponentModel

    Imports System.Diagnostics

    Imports System.Web.Services

    Imports System.Web.Services.Protocols

    Imports System.Xml.Serialization

    Namespace ws_nfeStatusa1

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053"), _

       System.Diagnostics.DebuggerStepThroughAttribute(), _

       System.ComponentModel.DesignerCategoryAttribute("code"), _

       System.Web.Services.WebServiceBindingAttribute(Name:="NfeStatusServico2Soap12", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> _

       Partial Public Class NfeStatusServico2a1

          Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

          Private nfeStatusServicoNF2OperationCompleted As System.Threading.SendOrPostCallback

          Private useDefaultCredentialsSetExplicitly As Boolean

          ''' <remarks/>

          Public Sub New()

             MyBase.New()

             Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12

             Me.Url = "https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico2.asmx"

             If (Me.IsLocalFileSystemWebService(Me.Url) = True) Then

                Me.UseDefaultCredentials = True

                Me.useDefaultCredentialsSetExplicitly = False

             Else

                Me.useDefaultCredentialsSetExplicitly = True

             End If

          End Sub

          Public Shadows Property Url() As String

             Get

                Return MyBase.Url

             End Get

             Set(ByVal value As String)

                If (((Me.IsLocalFileSystemWebService(MyBase.Url) = True) _

                            AndAlso (Me.useDefaultCredentialsSetExplicitly = False)) _

                            AndAlso (Me.IsLocalFileSystemWebService(value) = False)) Then

                   MyBase.UseDefaultCredentials = False

                End If

                MyBase.Url = value

             End Set

          End Property

          Public Shadows Property UseDefaultCredentials() As Boolean

             Get

                Return MyBase.UseDefaultCredentials

             End Get

             Set(ByVal value As Boolean)

                MyBase.UseDefaultCredentials = value

                Me.useDefaultCredentialsSetExplicitly = True

             End Set

          End Property

          ''' <remarks/>

          Public Event nfeStatusServicoNF2Completed As nfeStatusServicoNF2CompletedEventHandler

          '''<remarks/>

          <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2/nfeStatusServicoNF2", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _

          Public Function nfeStatusServicoNF2(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> ByVal nfeCabecMsg As System.Xml.XmlNode, <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> ByVal nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> System.Xml.XmlNode

             Dim results() As Object = Me.Invoke("nfeStatusServicoNF2", New Object() {nfeCabecMsg, nfeDadosMsg})

             Return CType(results(0), System.Xml.XmlNode)

          End Function

          '''<remarks/>

          Public Overloads Sub nfeStatusServicoNF2Async(ByVal nfeCabecMsg As System.Xml.XmlNode, ByVal nfeDadosMsg As System.Xml.XmlNode)

             Me.nfeStatusServicoNF2Async(nfeCabecMsg, nfeDadosMsg, Nothing)

          End Sub

          '''<remarks/>

          Public Overloads Sub nfeStatusServicoNF2Async(ByVal nfeCabecMsg As System.Xml.XmlNode, ByVal nfeDadosMsg As System.Xml.XmlNode, ByVal userState As Object)

             If (Me.nfeStatusServicoNF2OperationCompleted Is Nothing) Then

                Me.nfeStatusServicoNF2OperationCompleted = AddressOf Me.OnnfeStatusServicoNF2OperationCompleted

             End If

             Me.InvokeAsync("nfeStatusServicoNF2", New Object() {nfeCabecMsg, nfeDadosMsg}, Me.nfeStatusServicoNF2OperationCompleted, userState)

          End Sub

          Private Sub OnnfeStatusServicoNF2OperationCompleted(ByVal arg As Object)

             If (Not (Me.nfeStatusServicoNF2CompletedEvent) Is Nothing) Then

                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)

                RaiseEvent nfeStatusServicoNF2Completed(Me, New nfeStatusServicoNF2CompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))

             End If

          End Sub

          '''<remarks/>

          Public Shadows Sub CancelAsync(ByVal userState As Object)

             MyBase.CancelAsync(userState)

          End Sub

          Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean

             If ((url Is Nothing) _

                         OrElse (url Is String.Empty)) Then

                Return False

             End If

             Dim wsUri As System.Uri = New System.Uri(url)

             If ((wsUri.Port >= 1024) _

                         AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then

                Return True

             End If

             Return False

          End Function

       End Class

       ''<remarks/>

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")> _

       Public Delegate Sub nfeStatusServicoNF2CompletedEventHandler(ByVal sender As Object, ByVal e As nfeStatusServicoNF2CompletedEventArgs)

       '''<remarks/>

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053"), _

        System.Diagnostics.DebuggerStepThroughAttribute(), _

        System.ComponentModel.DesignerCategoryAttribute("code")> _

       Partial Public Class nfeStatusServicoNF2CompletedEventArgs

          Inherits System.ComponentModel.AsyncCompletedEventArgs

          Private results() As Object

          Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)

             MyBase.New(exception, cancelled, userState)

             Me.results = results

          End Sub

          '''<remarks/>

          Public ReadOnly Property Result() As System.Xml.XmlNode

             Get

                Me.RaiseExceptionIfNecessary()

                Return CType(Me.results(0), System.Xml.XmlNode)

             End Get

          End Property

       End Class

    End Namespace

    quarta-feira, 3 de dezembro de 2014 12:14

Todas as Respostas

  • Bruno

         Não sei se você conseguiu alguma coisa, mais no momento estou também neste processo de desenvolvimento  ( Consulta de Status de Web Service - NFe), veja até onde cheguei, mais estou com o seguinte erro de retorno, caso você saiba, ou consiga algo a mais basta dar um alô.

    242 - Rejeição: Cabeçalho - Falha no Schema XML


    <retConsStatServ versao="2.00" xmlns="http://www.portalfiscal.inf.br/nfe">
    <tpAmb>1</tpAmb>
    <verAplic>SP_NFE_PL_006q</verAplic>
    <cStat>242</cStat>
    <xMotivo>Rejeição: Cabeçalho - Falha no Schema XML</xMotivo>
    <cUF>35</cUF>
    <dhRecbto>2014-12-01T12:59:47</dhRecbto>
    </retConsStatServ>

    xml do Cabeçario

    <?xml version="1.0" encoding="UTF-8"?>
    <nfeCabecMsg versao="2.00" xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2">
    <versaoDados>2.00</versaoDados>
    <cUF>SP</cUF>
    </nfeCabecMsg>

    **********************************

    Private Sub btn_Processa_Click(sender As System.Object, e As System.EventArgs) Handles btn_Processa.Click

          Try

            Dim cl_Consulta_Status As New NFe_Statusxa1.NFeStatusxa1

             cl_Consulta_Status.Consulta_Statusxa1()

          Catch ex As Exception

          End Try

       End Sub

    **********************************

    Imports System.Xml

    Imports System.Security

    Imports System.Security.Cryptography

    Imports System.Security.Cryptography.X509Certificates

    Imports System.Windows.Forms

    Imports System.Globalization

    Imports nfelib.ws_nfeStatusa1

    Imports System.Text

    Namespace NFe_Statusxa1

       Public Class NFeStatusxa1

          Public Sub Consulta_Statusxa1()

             Dim result As XmlNode = Nothing

             Try

                Dim cert As X509Certificate2 = SelecionarCertificadox()

                Dim xmlns As New Serialization.XmlSerializerNamespaces

                Dim xmlDados As New XmlDocument

                Dim xmlCab As New XmlDocument

                Dim nfeStatusServ As New NfeStatusServico2a1

                nfeStatusServ.ClientCertificates.Add(cert)

                Dim ds_Versao As String = "2.00"

                Dim ic_Ambiente As Integer = 1

                Dim ds_UF As String = "SP"

                Dim id_UF As Integer = 35

                'xmlCab.LoadXml("<?xml version=""1.0"" encoding=""UTF-8""?><nfeCabecMsg xmlns=""http://www.portalfiscal.inf.br/nfe"" versao=""2.00""><versaoDados>2.00</versaoDados><cUF>35</cUF></nfeCabecMsg>")

                Dim xmlConsulta1 As New StringBuilder()

                xmlConsulta1.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")

                xmlConsulta1.Append("<nfeCabecMsg versao=""2.00"" xmlns=""http://www.portalfiscal.inf.br/nfe"">")

                xmlConsulta1.Append("<versaoDados>" + ds_Versao.ToString + "</versaoDados>")

                xmlConsulta1.Append("<cUF>" + ds_UF + "</cUF>")

                xmlConsulta1.Append("</nfeCabecMsg>")

                xmlCab.LoadXml(xmlConsulta1.ToString)

                'xmlDados.LoadXml("<?xml version=""1.0"" encoding=""utf-8""?><consStatServ xmlns=""http://www.portalfiscal.inf.br/nfe"" versao=""2.00""><tpAmb>1</tpAmb><cUF>35</cUF><xServ>STATUS</xServ></consStatServ>")

                Dim xmlConsulta2 As New StringBuilder()

                xmlConsulta2.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")

                xmlConsulta2.Append("<consStatServ versao=""2.00"" xmlns=""http://www.portalfiscal.inf.br/nfe"">")

                xmlConsulta2.Append("<tpAmb>" + ic_Ambiente.ToString + "</tpAmb>")

                xmlConsulta2.Append("<cUF>" + id_UF.ToString + "</cUF>")

                xmlConsulta2.Append("<xServ>STATUS</xServ>")

                xmlConsulta2.Append("</consStatServ>")

                xmlDados.LoadXml(xmlConsulta2.ToString)

                result = nfeStatusServ.nfeStatusServicoNF2(xmlCab, xmlDados)

                Dim cTeste As String = String.Empty

                cTeste = "ok"

                Console.WriteLine(result.OuterXml)

                Console.Read()

                MsgBox(result.OuterXml)

             Catch ex As Exception

                MsgBox(result.OuterXml)

             End Try

          End Sub

          Public Shared Function SelecionarCertificadox() As X509Certificate2

             'Listando certificados

             Dim store As New X509Store(StoreName.My)

             store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)

             Dim validCertificates As X509Certificate2Collection = store.Certificates.Find(X509FindType.FindByTimeValid, Now, True)

             If validCertificates.Count <= 0 Then Return Nothing

             Dim selected As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(validCertificates, "Selecione um certificado", "", X509SelectionFlag.SingleSelection)

             If selected.Count > 0 Then

                IO.File.AppendAllText("certificate.selection.log", Now.ToString("[yyyy-MM-dd HH:mm:ss]") & "Last public key selected: " & vbNewLine & selected(0).GetPublicKeyString & vbNewLine)

                Return selected(0)

             End If

             Return Nothing

          End Function

       End Class

    End Namespace

    **********************************

    Option Strict On

    Option Explicit On

    Imports System.ComponentModel

    Imports System.Diagnostics

    Imports System.Web.Services

    Imports System.Web.Services.Protocols

    Imports System.Xml.Serialization

    Namespace ws_nfeStatusa1

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053"), _

       System.Diagnostics.DebuggerStepThroughAttribute(), _

       System.ComponentModel.DesignerCategoryAttribute("code"), _

       System.Web.Services.WebServiceBindingAttribute(Name:="NfeStatusServico2Soap12", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> _

       Partial Public Class NfeStatusServico2a1

          Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

          Private nfeStatusServicoNF2OperationCompleted As System.Threading.SendOrPostCallback

          Private useDefaultCredentialsSetExplicitly As Boolean

          ''' <remarks/>

          Public Sub New()

             MyBase.New()

             Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12

             Me.Url = "https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico2.asmx"

             If (Me.IsLocalFileSystemWebService(Me.Url) = True) Then

                Me.UseDefaultCredentials = True

                Me.useDefaultCredentialsSetExplicitly = False

             Else

                Me.useDefaultCredentialsSetExplicitly = True

             End If

          End Sub

          Public Shadows Property Url() As String

             Get

                Return MyBase.Url

             End Get

             Set(ByVal value As String)

                If (((Me.IsLocalFileSystemWebService(MyBase.Url) = True) _

                            AndAlso (Me.useDefaultCredentialsSetExplicitly = False)) _

                            AndAlso (Me.IsLocalFileSystemWebService(value) = False)) Then

                   MyBase.UseDefaultCredentials = False

                End If

                MyBase.Url = value

             End Set

          End Property

          Public Shadows Property UseDefaultCredentials() As Boolean

             Get

                Return MyBase.UseDefaultCredentials

             End Get

             Set(ByVal value As Boolean)

                MyBase.UseDefaultCredentials = value

                Me.useDefaultCredentialsSetExplicitly = True

             End Set

          End Property

          ''' <remarks/>

          Public Event nfeStatusServicoNF2Completed As nfeStatusServicoNF2CompletedEventHandler

          '''<remarks/>

          <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2/nfeStatusServicoNF2", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _

          Public Function nfeStatusServicoNF2(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> ByVal nfeCabecMsg As System.Xml.XmlNode, <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> ByVal nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2")> System.Xml.XmlNode

             Dim results() As Object = Me.Invoke("nfeStatusServicoNF2", New Object() {nfeCabecMsg, nfeDadosMsg})

             Return CType(results(0), System.Xml.XmlNode)

          End Function

          '''<remarks/>

          Public Overloads Sub nfeStatusServicoNF2Async(ByVal nfeCabecMsg As System.Xml.XmlNode, ByVal nfeDadosMsg As System.Xml.XmlNode)

             Me.nfeStatusServicoNF2Async(nfeCabecMsg, nfeDadosMsg, Nothing)

          End Sub

          '''<remarks/>

          Public Overloads Sub nfeStatusServicoNF2Async(ByVal nfeCabecMsg As System.Xml.XmlNode, ByVal nfeDadosMsg As System.Xml.XmlNode, ByVal userState As Object)

             If (Me.nfeStatusServicoNF2OperationCompleted Is Nothing) Then

                Me.nfeStatusServicoNF2OperationCompleted = AddressOf Me.OnnfeStatusServicoNF2OperationCompleted

             End If

             Me.InvokeAsync("nfeStatusServicoNF2", New Object() {nfeCabecMsg, nfeDadosMsg}, Me.nfeStatusServicoNF2OperationCompleted, userState)

          End Sub

          Private Sub OnnfeStatusServicoNF2OperationCompleted(ByVal arg As Object)

             If (Not (Me.nfeStatusServicoNF2CompletedEvent) Is Nothing) Then

                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)

                RaiseEvent nfeStatusServicoNF2Completed(Me, New nfeStatusServicoNF2CompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))

             End If

          End Sub

          '''<remarks/>

          Public Shadows Sub CancelAsync(ByVal userState As Object)

             MyBase.CancelAsync(userState)

          End Sub

          Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean

             If ((url Is Nothing) _

                         OrElse (url Is String.Empty)) Then

                Return False

             End If

             Dim wsUri As System.Uri = New System.Uri(url)

             If ((wsUri.Port >= 1024) _

                         AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then

                Return True

             End If

             Return False

          End Function

       End Class

       ''<remarks/>

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")> _

       Public Delegate Sub nfeStatusServicoNF2CompletedEventHandler(ByVal sender As Object, ByVal e As nfeStatusServicoNF2CompletedEventArgs)

       '''<remarks/>

       <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053"), _

        System.Diagnostics.DebuggerStepThroughAttribute(), _

        System.ComponentModel.DesignerCategoryAttribute("code")> _

       Partial Public Class nfeStatusServicoNF2CompletedEventArgs

          Inherits System.ComponentModel.AsyncCompletedEventArgs

          Private results() As Object

          Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)

             MyBase.New(exception, cancelled, userState)

             Me.results = results

          End Sub

          '''<remarks/>

          Public ReadOnly Property Result() As System.Xml.XmlNode

             Get

                Me.RaiseExceptionIfNecessary()

                Return CType(Me.results(0), System.Xml.XmlNode)

             End Get

          End Property

       End Class

    End Namespace

    quarta-feira, 3 de dezembro de 2014 12:14
  • Legal em, poderia mandar para meu e-mail brunopardim@outlook.com, mais uma coisa sobre o erro que você esta tendo ai, já tentou usar a versão 3.10, http://www.nfe.fazenda.gov.br/portal/WebServices.aspx, em SP tem as duas versões dos serviços web service, 2.00 e 3.10.

    Ops desculpe ignora isso das versões do serviço, esta errado, mais sim a versão dos schemas XML, os esquemas link: http://www.nfe.fazenda.gov.br/portal/listaConteudo.aspx?tipoConteudo=/fwLvLUSmU8=


    quarta-feira, 3 de dezembro de 2014 12:52
  • Cara encontrei um exemplo funcional em vb6(aplicação e código fonte), segue abaixo o link :

    http://www.flexdocs.com.br/guiaNFe/historico.DLL.html

    quarta-feira, 3 de dezembro de 2014 13:55
  • Bruno

       Já chegamos a utilizar este recurso, ele utiliza uma dll sim, mais mesmo assim você precisa fazer alguns codigos para ter acesso a dll, veja com mais calma e depois você podera constar o que eu estou falando, é uma boa dll, é que no nosso caso queremos ter um controle sobre o processo melhor.

         E qualquer novidade você me avisa.

    • Editado neibala quarta-feira, 3 de dezembro de 2014 17:18 erro inesperado
    quarta-feira, 3 de dezembro de 2014 17:16