1
I already inform that I do not understand much of SOAP or XML and I’m only posting the question before studying a lot, because I’m on a very tight deadline.
I need to make an appointment at SEFAZ on webservice Nfedistribuicaodfe.
When opening the classes I found it very confusing so I added a ?WSDL
at the end and the webservice I return only with class NFeDistribuicaoDFe
.
Within that class I might notice that she hopes to receive one XmlNode
. Code of webservice:
/// <remarks/>
public event nfeDistDFeInteresseCompletedEventHandler nfeDistDFeInteresseCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe/nfeDistDFeInteresse", RequestNamespace="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe", ResponseNamespace="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Xml.XmlNode nfeDistDFeInteresse(System.Xml.XmlNode nfeDadosMsg) {
object[] results = this.Invoke("nfeDistDFeInteresse", new object[] {
nfeDadosMsg});
return ((System.Xml.XmlNode)(results[0]));
}
From what I understand Xmlnode is an XML node which I found strange, because I expected to send the full XML and not only its node, follows the code I did trying to consume this webservice:
try
{
string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<distDFeInt versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/nfe\">" +
"<tpAmb>1</tpAmb>" +
"<cUFAutor>35</cUFAutor>" +
"<CNPJ>99999999999999</CNPJ>" +
"<distNSU>" +
"<ultNSU>0</ultNSU>" +
"</distNSU>" +
"</distDFeInt>";
XmlNode xmlNodeRequest, xmlNodeResponse;
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
xmlNodeRequest = doc.FirstChild;
ServiceNFe.NFeDistribuicaoDFe nFeDistribuicao = new ServiceNFe.NFeDistribuicaoDFe();
xmlNodeResponse = nFeDistribuicao.nfeDistDFeInteresse(xmlNodeRequest);
}
catch (Exception ex)
{
Console.WriteLine("Erro: " + ex.Message);
Console.ReadLine();
}
Observing:: Servicenfe was created here:
This is the error you make when trying to execute:
Information from my xmlNodeRequest
(You’re just taking the first line, as I expected):
To lost, how do I send the full XML? this code is right?
and what is the question ? access the [tour] to know how to ask
– Rovann Linhalis
I forgot to put the error Rovann, I will insert, but in advance it does not work my Xmlnode takes only the first line of XML and when sending my ctch informs that it was not possible to create XML.
– Renan Pinheiro