Problem consumption Webservice NFS-e

Asked

Viewed 150 times

1

I am having several problems in the consumption of the webservice of Joinville, SC.

Homologation: https://nfemwshomologacao.joinville.sc.gov.br/NotaFiscal/Servicos.asmx?wsdl Production: https://nfemws.joinville.sc.gov.br/NotaFiscal/Servicos.asmx?wsdl

To consume the Webservice I did so: inserir a descrição da imagem aqui

And then to consume this Webservice, it went something like this:

private EnviarLoteRpsEnvio1 EmitirNFSe(X509Certificate2 certificado, EnviarLoteRpsEnvio envio)
{
#if DEBUG
   string enderecoBase = "https://nfemwshomologacao.joinville.sc.gov.br";
#else
   string enderecoBase = "https://nfemws.joinville.sc.gov.br";
#endif
   var client = new ServicosSoapClient(CriarBinding(), new EndpointAddress(enderecoBase + "/NotaFiscal/Servicos.asmx"));
   client.ClientCredentials.ClientCertificate.Certificate = certificado;
   return ((ServicosSoap)client).RecepcionarLoteRps(envio);
}

Problem 1

One of the problems is that class EnviarLoteRpsEnvio expected in the method cliente.RecepcionarLoteRps(envio) has 2 properties: LoteRps and Signature, both of the type XmlNode:

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="EnviarLoteRpsEnvio", WrapperNamespace="https://nfemwshomologacao.joinville.sc.gov.br", IsWrapped=true)]
public partial class EnviarLoteRpsEnvio {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="https://nfemwshomologacao.joinville.sc.gov.br", Order=0)]
    public System.Xml.XmlNode LoteRps;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="https://nfemwshomologacao.joinville.sc.gov.br", Order=1)]
    public System.Xml.XmlNode Signature;

    public EnviarLoteRpsEnvio() {
    }
}

How do I fill these fields? I created a class LoteRps and filled in the data requested by Webservice, turned into XmlDocument and put in this property, but the converted xml (picked up by Fiddler) is generated with the tag LoteRps duplicate: inserir a descrição da imagem aqui

Problem 2

The query I managed to make work, however I have a release error:

Server did not recognize the value of HTTP Header SOAPAction: https://nfemwshomologacao.joinville.sc.gov.br/ConsultarNfseRpsEnvio.

This happens because the production address is different. See how the proxy class was generated:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "https://nfemwshomologacao.joinville.sc.gov.br", ConfigurationName = "NFSe.Joinville.ServicosSoap")]
public interface ServicosSoap
{
    [System.ServiceModel.OperationContractAttribute(Action = "https://nfemwshomologacao.joinville.sc.gov.br/EnviarLoteRpsEnvio", ReplyAction = "*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
    Wiser.Servicos.NFSe.Joinville.EnviarLoteRpsEnvio1 RecepcionarLoteRps(Wiser.Servicos.NFSe.Joinville.EnviarLoteRpsEnvio request);

   /*Outros métodos*/
}

The approval address is fixed

Summary

Actually I’ve had a lot of problems with this Webservice, so my question is if I’m consuming the right way. I’ve consumed other Webservices without problem, that’s the only one that looks different. To issue the note I was able to make an http request by mounting the request manually, without using the proxy classes generated to consume the webservice. But it took a lot of work. Any suggestions?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.