2
I’m trying to consume the NFE download service on the farm:
https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx
Specification
http://www.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=2Z%20kcHOdpHs=
Using .Net, C#, MVC
but I have obtained the following error :
Remote server returned an error: (500) Internal Server Error.
The message I’ve been sending is :
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<nfeDistDFeInteresse>
<nfeDadosMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe">
<distDFeInt versao="1.00" xmlns="http://www.portalfiscal.inf.br/nfe">
<tpAmb>1</tpAmb>
<cUFAutor>31</cUFAutor>
<CNPJ>[CNPJ DA EMPRESA]</CNPJ>
<distNSU>
<ultNSU>000000000000000</ultNSU>
</distNSU>
</distDFeInt>
</nfeDadosMsg>
</nfeDistDFeInteresse>
</soap:Body>
</soap:Envelope>
I removed all spaces, consumption other services successfully
request.Method = "POST";
request.ContentType = "text/xml";
request.ContentLength = byteData.Length;
The certificate I’m sure is correct too.
Rebound that I can consume other services.
WSDL of the service
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe">
<s:element name="nfeDistDFeInteresse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="nfeDadosMsg">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="nfeDistDFeInteresseResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="nfeDistDFeInteresseResult">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="nfeDistDFeInteresseSoapIn">
<wsdl:part name="parameters" element="tns:nfeDistDFeInteresse"/>
</wsdl:message>
<wsdl:message name="nfeDistDFeInteresseSoapOut">
<wsdl:part name="parameters" element="tns:nfeDistDFeInteresseResponse"/>
</wsdl:message>
<wsdl:portType name="NFeDistribuicaoDFeSoap">
<wsdl:operation name="nfeDistDFeInteresse">
<wsdl:input message="tns:nfeDistDFeInteresseSoapIn"/>
<wsdl:output message="tns:nfeDistDFeInteresseSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NFeDistribuicaoDFeSoap" type="tns:NFeDistribuicaoDFeSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="nfeDistDFeInteresse">
<soap:operation soapAction="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe/nfeDistDFeInteresse" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="NFeDistribuicaoDFeSoap12" type="tns:NFeDistribuicaoDFeSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="nfeDistDFeInteresse">
<soap12:operation soapAction="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe/nfeDistDFeInteresse" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="NFeDistribuicaoDFe">
<wsdl:port name="NFeDistribuicaoDFeSoap" binding="tns:NFeDistribuicaoDFeSoap">
<soap:address location="https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx"/>
</wsdl:port>
<wsdl:port name="NFeDistribuicaoDFeSoap12" binding="tns:NFeDistribuicaoDFeSoap12">
<soap12:address location="https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Friend, thanks for the reply, I used exactly your XML (replacing the clear CNPJ), in the approval environment and even then it didn’t work. Until recently this service worked here, but it seems that just started this error.
– Glauber A A
I tested this xml. It’s working. Are you trying some other certificate related error?
– tssm
Do you know the Soapui tool? With Soapui you could configure the certificate and perform connection test with the xml url and tests.
– tssm