Webservice NFS-e, erro de autenticação

3 respostas
X

Galera,

Estou usando AXIS e não consigo resolver o seguinte erro:

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

O código segue abaixo:

String local = "https://www.esnfs.com.br:9443/enfsws/services/Enfs?wsdl";
    
   
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

	System.setProperty("javax.net.ssl.trustStoreType", "JKS");
	System.setProperty("javax.net.ssl.trustStore","./jssecacerts");
	System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

    System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
	System.setProperty("javax.net.ssl.keyStore","./piramideto2.pfx");
	System.setProperty("javax.net.ssl.keyStorePassword", "123456");

	System.setProperty("javax.net.ssl.trustStoreType", "JKS");
	System.setProperty("javax.net.ssl.trustStore", "./certifica.jks");
	System.setProperty("javax.net.ssl.trustStorePassword", "123456");
	
	System.setProperty("javax.net.ssl.trustStoreType", "JKS");
	System.setProperty("javax.net.ssl.trustStore", "./AC_Certisign_Multipla_G3.jks");
	System.setProperty("javax.net.ssl.trustStorePassword", "123456");  
	
	System.setProperty("javax.net.ssl.trustStoreType", "JKS");
	System.setProperty("javax.net.ssl.trustStore", "./AC_Certisign_G3.jks");
	System.setProperty("javax.net.ssl.trustStorePassword", "123456");
	
	System.setProperty("javax.net.ssl.trustStoreType", "JKS");
	System.setProperty("javax.net.ssl.trustStore", "./AC_Raiz_V1.jks");
	System.setProperty("javax.net.ssl.trustStorePassword", "123456");         
   
    Call call = (Call) new Service().createCall();

    call.setTargetEndpointAddress(local);

    call.setOperationName("esRecepcionarLoteRps");
    
    Object[] param = new Object[]{new String("1.0"),new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
															   "mensagem teste")};
    String ret = (String)call.invoke(param);
    
    System.out.println("Retorno : " + ret);

3 Respostas

S

Também estou com este mesmo erro, inclusive postei em outro tópico porém não consegui resolver ainda.

Erro: “HTTP transport error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”

danilolutz

stacheski, xpaolo

Estou com o mesmo problema que vocês, gostaria se possível saber quais foram as soluções que adotaram?

Obrigado!

danilolutz

Pessoal, eu encontrei a solução do problema:

Adicionei a linha com a seguinte configuração:

java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");

Obrigado a todos.

Criado 27 de abril de 2010
Ultima resposta 22 de mar. de 2012
Respostas 3
Participantes 3