FONTE NFE VB.NET

MARCOSLING 07/11/2017 20:00:10
#477691
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
FUTURA 08/11/2017 08:25:14
#477695
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.
MFLAVIO 08/11/2017 08:25:56
#477696
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
GEORGENES 08/11/2017 10:31:10
#477701
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 ?
MFLAVIO 08/11/2017 11:00:11
#477703
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
GEORGENES 08/11/2017 13:28:59
#477715
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[Ô].
MFLAVIO 09/11/2017 14:38:02
#477750
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
MARCOSLING 13/11/2017 14:51:39
#477810
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?
MFLAVIO 13/11/2017 17:02:04
#477817
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
MARCOSLING 13/11/2017 17:42:17
#477818
Bom... eu uso somente a sefaz virtual RS e está funcionando.
Página 225 de 228 [2276 registro(s)]
Faça seu login para responder