NFE - MANIFESTACAO DO DESTINATARIO
Bom dia,
Ultimamente foi anunciado que a manifestação sobre nota fiscal se tornou obrigatório para as grandes empresas, então as empresas tem um determinado prazo para realizar esse tipo de trabalho, porem existem uma séries de dificuldades na implantação desse tipo de trabalho, hoje estou aqui porque tenho um problema que estou ficando sem cabelos para resolver, o meu problema seria o seguinte toda vez que faço a conexão com o servidor web da Sefaz ele me retorna a seguinte mensagem:
O servidor remoto retornou um erro: (500) Erro interno do Servidor.
A seguir segue a rotina, gostaria de saber se alguém pode me ajudar?
Public Function enviaXML(ByVal CaminhoArqXml As String) As String
Dim store As New X509Store()
Dim GetCertificadoX509 As New X509Store([Ô]MY[Ô], StoreLocation.CurrentUser)
Dim certs As X509Certificate2Collection
[ô]Seleciona o certificado
GetCertificadoX509.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
certs = X509Certificate2UI.SelectFromCollection(GetCertificadoX509.Certificates, _
[Ô]Certificado(S) digital(is) disponÃvel(is)[Ô], [Ô]Selecione o certificado DeMARCHI digital[Ô], _
X509SelectionFlag.SingleSelection)
Dim cert1 As X509Certificate
cert1 = certs.Item(0)
Dim requestD As HttpWebRequest = DirectCast(WebRequest.Create([Ô]https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico2.asmx[Ô]), HttpWebRequest)
If certs.Count = 1 Then
Dim sSoapMessage As String
Dim sSoapAction As String = [Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2/nfeStatusServicoNF2[Ô]
With requestD
[ô]Arquivo a ser enviado
[ô]**********************************************************************************
Dim oReader As TextReader = File.OpenText(CaminhoArqXml)
sSoapMessage = [Ô][Ô]
[ô] Lê uma linha de cada vez até alcançar o fim do arquivo
While oReader.Peek() <> -1
Dim line As String = oReader.ReadLine()
sSoapMessage = sSoapMessage & line
End While
[ô]parametros para o envio do arquivo XML
[ô]**********************************************************************************
.ClientCertificates.Add(cert1)
.PreAuthenticate = True
.ServicePoint.Expect100Continue = False
.ContentType = [Ô]text/xml; charset=UTF-8[Ô]
.Method = [Ô]POST[Ô]
.Accept = [Ô]text/xml[Ô]
.Headers.Add([Ô]soapaction[Ô], sSoapAction)
[ô] Set the ContentType property of the WebRequest.
.ContentType = [Ô]application/x-www-form-urlencoded[Ô]
Try
[ô] Create POST data and convert it to a byte array.
Dim postData As String = sSoapMessage
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
[ô] Set the ContentLength property of the WebRequest.
.ContentLength = byteArray.Length
[ô] Get the request stream.
Dim dataStream As Stream = .GetRequestStream()
[ô] Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)
[ô] Close the Stream object.
dataStream.Close()
[ô] Get the response.
Dim response As WebResponse = .GetResponse()
[ô] Display the status.
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
[ô] Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()
[ô] Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
[ô] Read the content.
Dim oxmlresp As XDocument [ô]= reader.ReadToEnd()
[ô] Display the content.
[ô] Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
Catch ex As Exception
Return ex.Message
End Try
End With
requestD = Nothing
Else
Return [Ô]Certificado inválido![Ô]
End If
End Function
conteúdo do arquivo XML a ser enviado
<?xml version=[Ô]1.0[Ô] encoding=[Ô]utf-8[Ô] standalone=[Ô]no[Ô]?>
<consNFeDest xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô] versao=[Ô]1.01[Ô]>
<tpAmb>2</tpAmb>
<xServ>CONSULTAR NFE DEST</xServ>
<CNPJ>0?????10000???</CNPJ>
<indNFe>1</indNFe>
<indEmi>0</indEmi>
<ultNSU>0</ultNSU>
</consNFeDest>
Ultimamente foi anunciado que a manifestação sobre nota fiscal se tornou obrigatório para as grandes empresas, então as empresas tem um determinado prazo para realizar esse tipo de trabalho, porem existem uma séries de dificuldades na implantação desse tipo de trabalho, hoje estou aqui porque tenho um problema que estou ficando sem cabelos para resolver, o meu problema seria o seguinte toda vez que faço a conexão com o servidor web da Sefaz ele me retorna a seguinte mensagem:
O servidor remoto retornou um erro: (500) Erro interno do Servidor.
A seguir segue a rotina, gostaria de saber se alguém pode me ajudar?
Public Function enviaXML(ByVal CaminhoArqXml As String) As String
Dim store As New X509Store()
Dim GetCertificadoX509 As New X509Store([Ô]MY[Ô], StoreLocation.CurrentUser)
Dim certs As X509Certificate2Collection
[ô]Seleciona o certificado
GetCertificadoX509.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
certs = X509Certificate2UI.SelectFromCollection(GetCertificadoX509.Certificates, _
[Ô]Certificado(S) digital(is) disponÃvel(is)[Ô], [Ô]Selecione o certificado DeMARCHI digital[Ô], _
X509SelectionFlag.SingleSelection)
Dim cert1 As X509Certificate
cert1 = certs.Item(0)
Dim requestD As HttpWebRequest = DirectCast(WebRequest.Create([Ô]https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico2.asmx[Ô]), HttpWebRequest)
If certs.Count = 1 Then
Dim sSoapMessage As String
Dim sSoapAction As String = [Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2/nfeStatusServicoNF2[Ô]
With requestD
[ô]Arquivo a ser enviado
[ô]**********************************************************************************
Dim oReader As TextReader = File.OpenText(CaminhoArqXml)
sSoapMessage = [Ô][Ô]
[ô] Lê uma linha de cada vez até alcançar o fim do arquivo
While oReader.Peek() <> -1
Dim line As String = oReader.ReadLine()
sSoapMessage = sSoapMessage & line
End While
[ô]parametros para o envio do arquivo XML
[ô]**********************************************************************************
.ClientCertificates.Add(cert1)
.PreAuthenticate = True
.ServicePoint.Expect100Continue = False
.ContentType = [Ô]text/xml; charset=UTF-8[Ô]
.Method = [Ô]POST[Ô]
.Accept = [Ô]text/xml[Ô]
.Headers.Add([Ô]soapaction[Ô], sSoapAction)
[ô] Set the ContentType property of the WebRequest.
.ContentType = [Ô]application/x-www-form-urlencoded[Ô]
Try
[ô] Create POST data and convert it to a byte array.
Dim postData As String = sSoapMessage
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
[ô] Set the ContentLength property of the WebRequest.
.ContentLength = byteArray.Length
[ô] Get the request stream.
Dim dataStream As Stream = .GetRequestStream()
[ô] Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)
[ô] Close the Stream object.
dataStream.Close()
[ô] Get the response.
Dim response As WebResponse = .GetResponse()
[ô] Display the status.
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
[ô] Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()
[ô] Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
[ô] Read the content.
Dim oxmlresp As XDocument [ô]= reader.ReadToEnd()
[ô] Display the content.
[ô] Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
Catch ex As Exception
Return ex.Message
End Try
End With
requestD = Nothing
Else
Return [Ô]Certificado inválido![Ô]
End If
End Function
conteúdo do arquivo XML a ser enviado
<?xml version=[Ô]1.0[Ô] encoding=[Ô]utf-8[Ô] standalone=[Ô]no[Ô]?>
<consNFeDest xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô] versao=[Ô]1.01[Ô]>
<tpAmb>2</tpAmb>
<xServ>CONSULTAR NFE DEST</xServ>
<CNPJ>0?????10000???</CNPJ>
<indNFe>1</indNFe>
<indEmi>0</indEmi>
<ultNSU>0</ultNSU>
</consNFeDest>
Tem como postar o projeto ? Eu também estou precisando implantar isso, quem sabe eu consiga e possa te ajudar ao mesmo tempo.
Pessoal o webservice desta conexão é essa:
https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx
Não está divulgado no site da nota fiscal eletrônica (ConsNFeDest).
https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx
Não está divulgado no site da nota fiscal eletrônica (ConsNFeDest).
o service description
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<wsdl:definitions xmlns:s=[Ô]http://www.w3.org/2001/XMLSchema[Ô] xmlns:soap12=[Ô]http://schemas.xmlsoap.org/wsdl/soap12/[Ô] xmlns:mime=[Ô]http://schemas.xmlsoap.org/wsdl/mime/[Ô] xmlns:tns=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô] xmlns:soap=[Ô]http://schemas.xmlsoap.org/wsdl/soap/[Ô] xmlns:tm=[Ô]http://microsoft.com/wsdl/mime/textMatching/[Ô] xmlns:http=[Ô]http://schemas.xmlsoap.org/wsdl/http/[Ô] xmlns:soapenc=[Ô]http://schemas.xmlsoap.org/soap/encoding/[Ô] xmlns:wsdl=[Ô]http://schemas.xmlsoap.org/wsdl/[Ô] targetNamespace=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô]>
<wsdl:types>
<s:schema elementFormDefault=[Ô]qualified[Ô] targetNamespace=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô]>
<s:element name=[Ô]nfeDadosMsg[Ô]>
<s:complexType mixed=[Ô]true[Ô]>
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name=[Ô]nfeConsultaNFDestResult[Ô]>
<s:complexType mixed=[Ô]true[Ô]>
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name=[Ô]nfeCabecMsg[Ô] type=[Ô]tns:nfeCabecMsg[Ô]/>
<s:complexType name=[Ô]nfeCabecMsg[Ô]>
<s:sequence>
<s:element minOccurs=[Ô]0[Ô] maxOccurs=[Ô]1[Ô] name=[Ô]cUF[Ô] type=[Ô]s:string[Ô]/>
<s:element minOccurs=[Ô]0[Ô] maxOccurs=[Ô]1[Ô] name=[Ô]versaoDados[Ô] type=[Ô]s:string[Ô]/>
</s:sequence>
<s:anyAttribute/>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name=[Ô]nfeConsultaNFDestSoapIn[Ô]>
<wsdl:part name=[Ô]nfeDadosMsg[Ô] element=[Ô]tns:nfeDadosMsg[Ô]/>
</wsdl:message>
<wsdl:message name=[Ô]nfeConsultaNFDestSoapOut[Ô]>
<wsdl:part name=[Ô]nfeConsultaNFDestResult[Ô] element=[Ô]tns:nfeConsultaNFDestResult[Ô]/>
</wsdl:message>
<wsdl:message name=[Ô]nfeConsultaNFDestnfeCabecMsg[Ô]>
<wsdl:part name=[Ô]nfeCabecMsg[Ô] element=[Ô]tns:nfeCabecMsg[Ô]/>
</wsdl:message>
<wsdl:portType name=[Ô]NFeConsultaDestSoap[Ô]>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<wsdl:input message=[Ô]tns:nfeConsultaNFDestSoapIn[Ô]/>
<wsdl:output message=[Ô]tns:nfeConsultaNFDestSoapOut[Ô]/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name=[Ô]NFeConsultaDestSoap[Ô] type=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap:binding transport=[Ô]http://schemas.xmlsoap.org/soap/http[Ô]/>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<soap:operation soapAction=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest/nfeConsultaNFDest[Ô] style=[Ô]document[Ô]/>
<wsdl:input>
<soap:body use=[Ô]literal[Ô]/>
<soap:header message=[Ô]tns:nfeConsultaNFDestnfeCabecMsg[Ô] part=[Ô]nfeCabecMsg[Ô] use=[Ô]literal[Ô]/>
</wsdl:input>
<wsdl:output>
<soap:body use=[Ô]literal[Ô]/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name=[Ô]NFeConsultaDestSoap12[Ô] type=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap12:binding transport=[Ô]http://schemas.xmlsoap.org/soap/http[Ô]/>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<soap12:operation soapAction=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest/nfeConsultaNFDest[Ô] style=[Ô]document[Ô]/>
<wsdl:input>
<soap12:body use=[Ô]literal[Ô]/>
<soap12:header message=[Ô]tns:nfeConsultaNFDestnfeCabecMsg[Ô] part=[Ô]nfeCabecMsg[Ô] use=[Ô]literal[Ô]/>
</wsdl:input>
<wsdl:output>
<soap12:body use=[Ô]literal[Ô]/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name=[Ô]NFeConsultaDest[Ô]>
<wsdl:port name=[Ô]NFeConsultaDestSoap[Ô] binding=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap:address location=[Ô]https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx[Ô]/>
</wsdl:port>
<wsdl:port name=[Ô]NFeConsultaDestSoap12[Ô] binding=[Ô]tns:NFeConsultaDestSoap12[Ô]>
<soap12:address location=[Ô]https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx[Ô]/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<wsdl:definitions xmlns:s=[Ô]http://www.w3.org/2001/XMLSchema[Ô] xmlns:soap12=[Ô]http://schemas.xmlsoap.org/wsdl/soap12/[Ô] xmlns:mime=[Ô]http://schemas.xmlsoap.org/wsdl/mime/[Ô] xmlns:tns=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô] xmlns:soap=[Ô]http://schemas.xmlsoap.org/wsdl/soap/[Ô] xmlns:tm=[Ô]http://microsoft.com/wsdl/mime/textMatching/[Ô] xmlns:http=[Ô]http://schemas.xmlsoap.org/wsdl/http/[Ô] xmlns:soapenc=[Ô]http://schemas.xmlsoap.org/soap/encoding/[Ô] xmlns:wsdl=[Ô]http://schemas.xmlsoap.org/wsdl/[Ô] targetNamespace=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô]>
<wsdl:types>
<s:schema elementFormDefault=[Ô]qualified[Ô] targetNamespace=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest[Ô]>
<s:element name=[Ô]nfeDadosMsg[Ô]>
<s:complexType mixed=[Ô]true[Ô]>
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name=[Ô]nfeConsultaNFDestResult[Ô]>
<s:complexType mixed=[Ô]true[Ô]>
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name=[Ô]nfeCabecMsg[Ô] type=[Ô]tns:nfeCabecMsg[Ô]/>
<s:complexType name=[Ô]nfeCabecMsg[Ô]>
<s:sequence>
<s:element minOccurs=[Ô]0[Ô] maxOccurs=[Ô]1[Ô] name=[Ô]cUF[Ô] type=[Ô]s:string[Ô]/>
<s:element minOccurs=[Ô]0[Ô] maxOccurs=[Ô]1[Ô] name=[Ô]versaoDados[Ô] type=[Ô]s:string[Ô]/>
</s:sequence>
<s:anyAttribute/>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name=[Ô]nfeConsultaNFDestSoapIn[Ô]>
<wsdl:part name=[Ô]nfeDadosMsg[Ô] element=[Ô]tns:nfeDadosMsg[Ô]/>
</wsdl:message>
<wsdl:message name=[Ô]nfeConsultaNFDestSoapOut[Ô]>
<wsdl:part name=[Ô]nfeConsultaNFDestResult[Ô] element=[Ô]tns:nfeConsultaNFDestResult[Ô]/>
</wsdl:message>
<wsdl:message name=[Ô]nfeConsultaNFDestnfeCabecMsg[Ô]>
<wsdl:part name=[Ô]nfeCabecMsg[Ô] element=[Ô]tns:nfeCabecMsg[Ô]/>
</wsdl:message>
<wsdl:portType name=[Ô]NFeConsultaDestSoap[Ô]>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<wsdl:input message=[Ô]tns:nfeConsultaNFDestSoapIn[Ô]/>
<wsdl:output message=[Ô]tns:nfeConsultaNFDestSoapOut[Ô]/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name=[Ô]NFeConsultaDestSoap[Ô] type=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap:binding transport=[Ô]http://schemas.xmlsoap.org/soap/http[Ô]/>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<soap:operation soapAction=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest/nfeConsultaNFDest[Ô] style=[Ô]document[Ô]/>
<wsdl:input>
<soap:body use=[Ô]literal[Ô]/>
<soap:header message=[Ô]tns:nfeConsultaNFDestnfeCabecMsg[Ô] part=[Ô]nfeCabecMsg[Ô] use=[Ô]literal[Ô]/>
</wsdl:input>
<wsdl:output>
<soap:body use=[Ô]literal[Ô]/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name=[Ô]NFeConsultaDestSoap12[Ô] type=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap12:binding transport=[Ô]http://schemas.xmlsoap.org/soap/http[Ô]/>
<wsdl:operation name=[Ô]nfeConsultaNFDest[Ô]>
<soap12:operation soapAction=[Ô]http://www.portalfiscal.inf.br/nfe/wsdl/NfeConsultaDest/nfeConsultaNFDest[Ô] style=[Ô]document[Ô]/>
<wsdl:input>
<soap12:body use=[Ô]literal[Ô]/>
<soap12:header message=[Ô]tns:nfeConsultaNFDestnfeCabecMsg[Ô] part=[Ô]nfeCabecMsg[Ô] use=[Ô]literal[Ô]/>
</wsdl:input>
<wsdl:output>
<soap12:body use=[Ô]literal[Ô]/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name=[Ô]NFeConsultaDest[Ô]>
<wsdl:port name=[Ô]NFeConsultaDestSoap[Ô] binding=[Ô]tns:NFeConsultaDestSoap[Ô]>
<soap:address location=[Ô]https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx[Ô]/>
</wsdl:port>
<wsdl:port name=[Ô]NFeConsultaDestSoap12[Ô] binding=[Ô]tns:NFeConsultaDestSoap12[Ô]>
<soap12:address location=[Ô]https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx[Ô]/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Tópico encerrado , respostas não são mais permitidas