Questions about how to consume ws NfS-e Curitiba [closed]

-2

Nownextmyreturnisjustlikethis

<EnviarLoteRpsRespostaxmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NumeroLote xsi:nil="true" />
  <DataRecebimento xsi:nil="true" />
  <ListaMensagemRetorno>
    <MensagemRetorno>
      <Codigo>E504</Codigo>
      <Mensagem>O certificado digital do prestador de serviços é obrigatório.</Mensagem>
      <Correcao>Envie junto a requisição do serviço o certificado digital do prestador de serviços.</Correcao>
    </MensagemRetorno>
  </ListaMensagemRetorno>
</EnviarLoteRpsResposta>

Follow my authentication

  public void chamadaWs(String xml) {
        URL wsdlURL = WSX0020X0020NFSEX0020V1001.WSX0020X0020NFSEX0020V1001_WSDL_LOCATION;
        QName WSX0020X0020NFSEX0020V1001_QNAME = new QName("http://www.e-governeapps2.com.br/", "WS_x0020_-_x0020_NFS-e_x0020_V1.0.0.1");
        WSX0020X0020NFSEX0020V1001 ss = new WSX0020X0020NFSEX0020V1001(wsdlURL, WSX0020X0020NFSEX0020V1001_QNAME);
        WSX0020X0020NFSEX0020V1001Soap port = ss.getWSX0020X0020NFSEX0020V1001Soap();

        String retorno = port.recepcionarXml("RecepcionarLoteRps", xml);

        System.out.println("recepcionarLoteRps.result=" + retorno);
    }

    private void autentica() {
        String caminhoDoCertificadoDoCliente = "C:\Nf-se\certificado.pfx";
        String senhaDoCertificadoDoCliente = "123456";
        String caminhoDoKeyStore = "C:\Nf-se\cacerts";
        String senhaDoKeyStore = "123456";

        System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
        System.clearProperty("javax.net.ssl.keyStore");
        System.clearProperty("javax.net.ssl.keyStorePassword");
        System.clearProperty("javax.net.ssl.trustStore");
        System.setProperty("javax.net.ssl.keyStore", caminhoDoCertificadoDoCliente);
        System.setProperty("javax.net.ssl.keyStorePassword", senhaDoCertificadoDoCliente);
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
        System.setProperty("javax.net.ssl.trustStore", caminhoDoKeyStore);

    }
    
asked by anonymous 05.12.2016 / 19:50

2 answers

2

The City Hall of Curitiba has already been my client. Typically, Web Services is done in C #, whose documentation can be easily accessed through the following address:

  

link

In case, the method you need to call is RecepcionarXml , which is here:

  

link

The best way to test this manually is by using a tool such as SoapUI . Simply use this WSDL within a SoapUI request that the application mounts the request XML for you. You will have to manually paste the XML into the request form in order to send. Here is a tutorial .

Once this is done, just consume the Web Service .

    
05.12.2016 / 21:59
0

The connection is HTTPS as soon as you need to have the digital certificate type A1 / A4 to access wsdl, or create a fake certificate on their site for the pilot server, it has #

But if I use the pilot certificate I believe it will have limitations on consumption, so the best would be a real certificate anyway.

link

HTTPS:

You need to generate a cacerts file with the keys, to do with the keytool tool in Java, or to use that InstallCert.java class that has lots of versions out there, even in my gist .

At this point you add url's https, how many you need as you increase the number of prefectures.

  

get ("isscuritiba.curitiba.pr.gov.br", 443, ks);

As for the certificate using the pilot or an original certificate nothing will happen if you do not link the same in their system, and for this a registration with the city hall is necessary.

In the past when I developed I lost a lot of time trying to make it work then I found out that it was only possible to do it through the IE browser (I do not know if it's still like this).

Once these steps are done you will be able to test with SoapUI and also generate your Java stubs to use in invoking code in these services, but you need to read the manuals, there is everything there.

Properties:

 public static void AssinaSSL(String caminhoCertificado, String senhaCertificado) {
        System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
        System.clearProperty("javax.net.ssl.keyStore");
        System.clearProperty("javax.net.ssl.keyStorePassword");
        System.clearProperty("javax.net.ssl.trustStore");
        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
        System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
        System.setProperty("javax.net.ssl.keyStore", caminhoCertificado);
        System.setProperty("javax.net.ssl.keyStorePassword", senhaCertificado);
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
        System.setProperty("javax.net.ssl.trustStore", "/nfse/certificados/cacerts");
    }
    
06.12.2016 / 17:40