FONTE NFE VB.NET

 Tópico anterior Próximo tópico Novo tópico

FONTE NFE VB.NET

VB.NET

 Compartilhe  Compartilhe  Compartilhe
#477691 - 07/11/2017 20:00:10

MARCOSLING
SAO PAULO
Cadast. em:Agosto/2008


Citação:
:
Algum exemplo de como se comunicar versão 4.0 com TLS 1.2 ?


Usando como base o fonte postado, antes de criar o HttpWebRequest vc precisa colocar:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

Mas precisa usar o framework a partir do 4.5




#477695 - 08/11/2017 08:25:14

FUTURA
.
Cadast. em:Maio/2004


Saiu atualização de NT ontem, prorrogando os prazos, inclusive a desativação da versão 3.10 que era pra abril/2018 passou pra julho/2018, no meu ponto de vista, é cedo pra tentar colocar no ar.



#477696 - 08/11/2017 08:25:56

MFLAVIO
CAMPINAS
Cadast. em:Maio/2009


Citação:
:
  Cara eu consegui pegar o status do Servidor mais não estou conseguindo enviar lotes ao sefaz
Eu vi sua função, mas não consegui testar porque envolve outras função que vc não postou.



Função que Executa a Verificação

  Try
            Dim strRetorno As XmlElement
            Dim certificado As X509Certificate2 = CertificadoDigital.SelecionarCertificado("")

            Pnome = LeArquivoINI(Nome_arquivo_IniNFE, "Nota", "hambiente", "Configure")' Pega o Ambiente (produção ou Homologação)
            If MinhaUF() = "" Then MinhaUF() 'pega a UF (SP,MG,SC .....)
            UrlAcesso = BuscaURL(MinhaUF, Pnome) ' Carrega os Webservices

            Static wsMSG As StatusNFe4.NFeStatusServico4
            wsMSG = New StatusNFe4.NFeStatusServico4(UrlAcesso.UrlNfeStatusServico4)
            wsMSG.Timeout = 100000
            wsMSG.ClientCertificates.Add(certificado)
            System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, System.Net.SecurityProtocolType)

            Dim Dados As XmlDocument = New XmlDocument
            Dados.LoadXml("<?xml version=""1.0"" encoding=""UTF-8""?><consStatServ versao=""4.00"" xmlns=""http://www.portalfiscal.inf.br/nfe""><tpAmb>" & UrlAcesso.TpAnbiente & "</tpAmb><cUF>" & PegaCodUF(MinhaUF) & "</cUF><xServ>STATUS</xServ></consStatServ>")
            strRetorno = wsMSG.nfeStatusServicoNF(Dados)
            Resultado.LimpaDados()
            For Each outerNode As XmlNode In strRetorno
                Select Case outerNode.Name

                    Case "tpAmb"
                        Resultado.tpAmb = outerNode.InnerText

                    Case "verAplic"
                        Resultado.verAplic = outerNode.InnerText

                    Case "cStat"
                        Resultado.cStat = outerNode.InnerText

                    Case "xMotivo"
                        Resultado.xMotivo = outerNode.InnerText

                    Case "cUF"
                        Resultado.cUF = outerNode.InnerText
                End Select
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try


Classe StatusNFe4 q

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:4.0.30319.1
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization


Namespace StatusNFe4

    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1"), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code"), _
     System.Web.Services.WebServiceBindingAttribute(Name:="NFeStatusServico4ServiceBinding", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4")> _
    Partial Public Class NFeStatusServico4
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

        Private nfeStatusServicoNFOperationCompleted As System.Threading.SendOrPostCallback

        Private useDefaultCredentialsSetExplicitly As Boolean

        '''<remarks/>
        Public Sub New(ByVal v_RUL As String)
            MyBase.New()
            Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12
            Me.Url = v_RUL 'Global.WindowsApplication1.My.MySettings.Default.WindowsApplication5_StatusGO_NFeStatusServico4
            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 nfeStatusServicoNFCompleted As nfeStatusServicoNFCompletedEventHandler

        '''<remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4/nfeStatusServicoNF", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
        Public Function nfeStatusServicoNF(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4")> ByVal nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute("nfeResultMsg", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4")> System.Xml.XmlNode
            Dim results() As Object = Me.Invoke("nfeStatusServicoNF", New Object() {nfeDadosMsg})
            Return CType(results(0), System.Xml.XmlNode)
        End Function

        '''<remarks/>
        Public Overloads Sub nfeStatusServicoNFAsync(ByVal nfeDadosMsg As System.Xml.XmlNode)
            Me.nfeStatusServicoNFAsync(nfeDadosMsg, Nothing)
        End Sub

        '''<remarks/>
        Public Overloads Sub nfeStatusServicoNFAsync(ByVal nfeDadosMsg As System.Xml.XmlNode, ByVal userState As Object)
            If (Me.nfeStatusServicoNFOperationCompleted Is Nothing) Then
                Me.nfeStatusServicoNFOperationCompleted = AddressOf Me.OnnfeStatusServicoNFOperationCompleted
            End If
            Me.InvokeAsync("nfeStatusServicoNF", New Object() {nfeDadosMsg}, Me.nfeStatusServicoNFOperationCompleted, userState)
        End Sub

        Private Sub OnnfeStatusServicoNFOperationCompleted(ByVal arg As Object)
            If (Not (Me.nfeStatusServicoNFCompletedEvent) Is Nothing) Then
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)
                RaiseEvent nfeStatusServicoNFCompleted(Me, New nfeStatusServicoNFCompletedEventArgs(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", "4.0.30319.1")> _
    Public Delegate Sub nfeStatusServicoNFCompletedEventHandler(ByVal sender As Object, ByVal e As nfeStatusServicoNFCompletedEventArgs)

    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1"), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code")> _
    Partial Public Class nfeStatusServicoNFCompletedEventArgs
        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
  


Deus e o maior dos Programadores, ele criou tudo em liguagem visual
                                           .... e viu Deus que era bom


#477701 - 08/11/2017 10:31:10

GEORGENES
SAO PAULO
Cadast. em:Julho/2012


Citação:
:
:
Algum exemplo de como se comunicar versão 4.0 com TLS 1.2 ?

Usando como base o fonte postado, antes de criar o HttpWebRequest vc precisa colocar:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

Mas precisa usar o framework a partir do 4.5

Este tambem esta sendo meu tormento , uso vs 2010, tenho que migrar para 2015 para usar o framework 4.5, esta dando problemas de conversao principalmente nos forms, creio que terei grandes problemas futuros.
Entretanto alguem teria uma dica se é possivel fazer o vs2010 trabalhar com  framework 4.5 ?



#477703 - 08/11/2017 11:00:11

MFLAVIO
CAMPINAS
Cadast. em:Maio/2009


Citação:
:
:
:
Algum exemplo de como se comunicar versão 4.0 com TLS 1.2 ?

Usando como base o fonte postado, antes de criar o HttpWebRequest vc precisa colocar:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

Mas precisa usar o framework a partir do 4.5

Este tambem esta sendo meu tormento , uso vs 2010, tenho que migrar para 2015 para usar o framework 4.5, esta dando problemas de conversao principalmente nos forms, creio que terei grandes problemas futuros.
Entretanto alguem teria uma dica se é possivel fazer o vs2010 trabalhar com  framework 4.5 ?


estou no mesmo Pé, e pior tenho vários clientes que usam windows XP ainda, o que fazer

Deus e o maior dos Programadores, ele criou tudo em liguagem visual
                                           .... e viu Deus que era bom


#477715 - 08/11/2017 13:28:59

GEORGENES
SAO PAULO
Cadast. em:Julho/2012


Citação:
:
Qual UF ?
Esta parecendo falta de atualização de certificado digital, ta um saco isso.

RESOLVIDO !!!!
De fato era atualizacao do certificado ICP-Brasil v5.
Porem eu estava cometendo um erro na instalacao indicando o repositorio padrao, onde o correto é escolher o repositorio "Autoridades de Certificação Raiz confiaveis".




#477750 - 09/11/2017 14:38:02

MFLAVIO
CAMPINAS
Cadast. em:Maio/2009


Última edição em 09/11/2017 15:05:32 por MFLAVIO

Pessoal alguem conseguiu enviar o Lote para o Webservice 4.0 ja fiz de tudo que imaginava e não consigo enviar

eu gerei essa classe para envio mais esta dando erro de uri

  Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Namespace NFEAutorizacao

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Web.Services.WebServiceBindingAttribute(Name:="NfeAutorizacao4ServiceBinding", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    Partial Public Class NfeAutorizacao
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

        Private nfeStatusServicoNFOperationCompleted As System.Threading.SendOrPostCallback

        Private useDefaultCredentialsSetExplicitly As Boolean

        ''' <remarks/>
        Public Sub New(urlRef As String)
            Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12
            Me.Url = urlRef
            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(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(value As Boolean)
                MyBase.UseDefaultCredentials = value
                Me.useDefaultCredentialsSetExplicitly = True
            End Set
        End Property

        ''' <remarks/>
        Public Event nfeAutorizacaoLoteCompleted As nfeAutorizacaoLoteCompletedEventHandler

        ''' <remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4/nfeAutorizacaoLote", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
        Public Function nfeAutorizacaoLote(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao")> nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> System.Xml.XmlNode
            Dim results As Object() = Me.Invoke("nfeAutorizacao4", New Object() {nfeDadosMsg})
            Return DirectCast(results(0), System.Xml.XmlNode)
        End Function

        ''' <remarks/>
        Public Sub nfeAutorizacaoLoteAsync(nfeDadosMsg As System.Xml.XmlNode)
            Me.nfeAutorizacaoLoteAsync(nfeDadosMsg)
        End Sub

        Private Sub OnnfeAutorizacaoLoteOperationCompleted(arg As Object)
            If arg IsNot Nothing Then
                'nfeAutorizacaoLoteCompleted
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = DirectCast(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)
                'nfeAutorizacaoLoteCompleted(Me, New nfeAutorizacaoLoteCompletedEventArgs(invokeArgs.Results, invokeArgs.[Error], invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub

        ''' <remarks/>
        Public Shadows Sub CancelAsync(userState As Object)
            MyBase.CancelAsync(userState)
        End Sub

        Private Function IsLocalFileSystemWebService(url As String) As Boolean
            If ((url Is Nothing) OrElse (url = String.Empty)) Then
                Return False
            End If
            Dim wsUri As 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.Xml", "4.0.30319.1")> _
    <System.SerializableAttribute()> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    <System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4", IsNullable:=False)> _
    Partial Public Class nfeCabecMsg

        Inherits System.Web.Services.Protocols.SoapHeader

        Private cUFField As String

        Private versaoDadosField As String

        ''' <remarks/>
        Public Property cUF() As String
            Get
                Return Me.cUFField
            End Get
            Set(value As String)
                Me.cUFField = value
            End Set
        End Property

        ''' <remarks/>
        Public Property versaoDados() As String
            Get
                Return Me.versaoDadosField
            End Get
            Set(value As String)
                Me.versaoDadosField = value
            End Set
        End Property
    End Class

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    Public Delegate Sub nfeAutorizacaoLoteCompletedEventHandler(sender As Object, e As nfeAutorizacaoLoteCompletedEventArgs)

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    Partial Public Class nfeAutorizacaoLoteCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs

        Private results As Object()

        Friend Sub New(results As Object(), exception As System.Exception, cancelled As Boolean, 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 DirectCast(Me.results(0), System.Xml.XmlNode)
            End Get
        End Property
    End Class
End Namespace


Deus e o maior dos Programadores, ele criou tudo em liguagem visual
                                           .... e viu Deus que era bom


#477810 - 13/11/2017 14:51:39

MARCOSLING
SAO PAULO
Cadast. em:Agosto/2008


Citação:
:
Pessoal alguem conseguiu enviar o Lote para o Webservice 4.0 ja fiz de tudo que imaginava e não consigo enviar

eu gerei essa classe para envio mais esta dando erro de uri

  Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Namespace NFEAutorizacao

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Web.Services.WebServiceBindingAttribute(Name:="NfeAutorizacao4ServiceBinding", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    Partial Public Class NfeAutorizacao
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

        Private nfeStatusServicoNFOperationCompleted As System.Threading.SendOrPostCallback

        Private useDefaultCredentialsSetExplicitly As Boolean

        ''' <remarks/>
        Public Sub New(urlRef As String)
            Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12
            Me.Url = urlRef
            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(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(value As Boolean)
                MyBase.UseDefaultCredentials = value
                Me.useDefaultCredentialsSetExplicitly = True
            End Set
        End Property

        ''' <remarks/>
        Public Event nfeAutorizacaoLoteCompleted As nfeAutorizacaoLoteCompletedEventHandler

        ''' <remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4/nfeAutorizacaoLote", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
        Public Function nfeAutorizacaoLote(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao")> nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> System.Xml.XmlNode
            Dim results As Object() = Me.Invoke("nfeAutorizacao4", New Object() {nfeDadosMsg})
            Return DirectCast(results(0), System.Xml.XmlNode)
        End Function

        ''' <remarks/>
        Public Sub nfeAutorizacaoLoteAsync(nfeDadosMsg As System.Xml.XmlNode)
            Me.nfeAutorizacaoLoteAsync(nfeDadosMsg)
        End Sub

        Private Sub OnnfeAutorizacaoLoteOperationCompleted(arg As Object)
            If arg IsNot Nothing Then
                'nfeAutorizacaoLoteCompleted
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = DirectCast(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)
                'nfeAutorizacaoLoteCompleted(Me, New nfeAutorizacaoLoteCompletedEventArgs(invokeArgs.Results, invokeArgs.[Error], invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub

        ''' <remarks/>
        Public Shadows Sub CancelAsync(userState As Object)
            MyBase.CancelAsync(userState)
        End Sub

        Private Function IsLocalFileSystemWebService(url As String) As Boolean
            If ((url Is Nothing) OrElse (url = String.Empty)) Then
                Return False
            End If
            Dim wsUri As 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.Xml", "4.0.30319.1")> _
    <System.SerializableAttribute()> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    <System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4", IsNullable:=False)> _
    Partial Public Class nfeCabecMsg

        Inherits System.Web.Services.Protocols.SoapHeader

        Private cUFField As String

        Private versaoDadosField As String

        ''' <remarks/>
        Public Property cUF() As String
            Get
                Return Me.cUFField
            End Get
            Set(value As String)
                Me.cUFField = value
            End Set
        End Property

        ''' <remarks/>
        Public Property versaoDados() As String
            Get
                Return Me.versaoDadosField
            End Get
            Set(value As String)
                Me.versaoDadosField = value
            End Set
        End Property
    End Class

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    Public Delegate Sub nfeAutorizacaoLoteCompletedEventHandler(sender As Object, e As nfeAutorizacaoLoteCompletedEventArgs)

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    Partial Public Class nfeAutorizacaoLoteCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs

        Private results As Object()

        Friend Sub New(results As Object(), exception As System.Exception, cancelled As Boolean, 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 DirectCast(Me.results(0), System.Xml.XmlNode)
            End Get
        End Property
    End Class
End Namespace


Qual é o servidor que vc está utilizando?



#477817 - 13/11/2017 17:02:04

MFLAVIO
CAMPINAS
Cadast. em:Maio/2009


Citação:
:
:
Pessoal alguem conseguiu enviar o Lote para o Webservice 4.0 ja fiz de tudo que imaginava e não consigo enviar

eu gerei essa classe para envio mais esta dando erro de uri

  Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Namespace NFEAutorizacao

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Web.Services.WebServiceBindingAttribute(Name:="NfeAutorizacao4ServiceBinding", [Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    Partial Public Class NfeAutorizacao
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

        Private nfeStatusServicoNFOperationCompleted As System.Threading.SendOrPostCallback

        Private useDefaultCredentialsSetExplicitly As Boolean

        ''' <remarks/>
        Public Sub New(urlRef As String)
            Me.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12
            Me.Url = urlRef
            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(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(value As Boolean)
                MyBase.UseDefaultCredentials = value
                Me.useDefaultCredentialsSetExplicitly = True
            End Set
        End Property

        ''' <remarks/>
        Public Event nfeAutorizacaoLoteCompleted As nfeAutorizacaoLoteCompletedEventHandler

        ''' <remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4/nfeAutorizacaoLote", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
        Public Function nfeAutorizacaoLote(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao")> nfeDadosMsg As System.Xml.XmlNode) As <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> System.Xml.XmlNode
            Dim results As Object() = Me.Invoke("nfeAutorizacao4", New Object() {nfeDadosMsg})
            Return DirectCast(results(0), System.Xml.XmlNode)
        End Function

        ''' <remarks/>
        Public Sub nfeAutorizacaoLoteAsync(nfeDadosMsg As System.Xml.XmlNode)
            Me.nfeAutorizacaoLoteAsync(nfeDadosMsg)
        End Sub

        Private Sub OnnfeAutorizacaoLoteOperationCompleted(arg As Object)
            If arg IsNot Nothing Then
                'nfeAutorizacaoLoteCompleted
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = DirectCast(arg, System.Web.Services.Protocols.InvokeCompletedEventArgs)
                'nfeAutorizacaoLoteCompleted(Me, New nfeAutorizacaoLoteCompletedEventArgs(invokeArgs.Results, invokeArgs.[Error], invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub

        ''' <remarks/>
        Public Shadows Sub CancelAsync(userState As Object)
            MyBase.CancelAsync(userState)
        End Sub

        Private Function IsLocalFileSystemWebService(url As String) As Boolean
            If ((url Is Nothing) OrElse (url = String.Empty)) Then
                Return False
            End If
            Dim wsUri As 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.Xml", "4.0.30319.1")> _
    <System.SerializableAttribute()> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4")> _
    <System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao4", IsNullable:=False)> _
    Partial Public Class nfeCabecMsg

        Inherits System.Web.Services.Protocols.SoapHeader

        Private cUFField As String

        Private versaoDadosField As String

        ''' <remarks/>
        Public Property cUF() As String
            Get
                Return Me.cUFField
            End Get
            Set(value As String)
                Me.cUFField = value
            End Set
        End Property

        ''' <remarks/>
        Public Property versaoDados() As String
            Get
                Return Me.versaoDadosField
            End Get
            Set(value As String)
                Me.versaoDadosField = value
            End Set
        End Property
    End Class

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    Public Delegate Sub nfeAutorizacaoLoteCompletedEventHandler(sender As Object, e As nfeAutorizacaoLoteCompletedEventArgs)

    ''' <remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    Partial Public Class nfeAutorizacaoLoteCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs

        Private results As Object()

        Friend Sub New(results As Object(), exception As System.Exception, cancelled As Boolean, 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 DirectCast(Me.results(0), System.Xml.XmlNode)
            End Get
        End Property
    End Class
End Namespace


Qual é o servidor que vc está utilizando?


Produção
https://nfe.fazenda.sp.gov.br/ws/nfeautorizacao4.asmx

homologação
​https://homologacao.nfe.fazenda.sp.gov.br/ws/nfeautorizacao4.asmx

Deus e o maior dos Programadores, ele criou tudo em liguagem visual
                                           .... e viu Deus que era bom


#477818 - 13/11/2017 17:42:17

MARCOSLING
SAO PAULO
Cadast. em:Agosto/2008


Bom... eu uso somente a sefaz virtual RS e está funcionando.



 Tópico anterior Próximo tópico Novo tópico


Para responder este tópico o login é requerido
Se você já possui uma conta de usuário por favor faça seu login
Se você não possui uma conta de usuário use a opção Criar usuário