Alias,
Vou inclusive aproveitar o tópico…
Alguem tem alguma dica, um bom tutorial ou uma formula mágica de como usar WebServices com SSL?
Preferencialmente AXIS [ parece ser mais fácil ].
Primeiramente… eu não armazenei meu certificado com o keytool, mas, estranhamente aproveitando alguns tópicos desse forum… consegui fazer a assinatura carregando em tempo de execução o meu pfx. Tenho um certificado A1.
Eu preferia não armazena-lo, se for possível, em um jks. Prefiro chama-lo como arquivo.
Usando o método
[code]Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName(“http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico”, “nfeStatusServicoNF”));
//call.addParameter(“nfeCabecMsg”, XMLType.XSD_STRING, ParameterMode.IN);
//call.addParameter(“nfeDadosMsg”, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
String ret = (String) call.invoke( new Object[] { /cabecMsg, consStatServ/ } ); [/code] eu obtive a seguinte resposta:
[quote]AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: Default SSL context init failed: null[/quote]
Ou seja, Está faltando alguns parâmetros default para o ssl: O Certificado, creio eu;
Agora,
Eu tentei fazer o que não fiz na hora da assinatura: Eu informei no properties os caminhos para o certificado:
System.setProperty("javax.net.ssl.keyStore", "PKCS12");
System.setProperty("javax.net.ssl.keyStoreURL", APPSet.getProperty("certificado"));
System.setProperty("javax.net.ssl.keyStorePassword", Util.undoHexCodified(APPSet.getProperty("pin")));
Mas, Não fui tão bem sucedido…
Alguem tem uma luz?
Alguem sabe como eu uso ssl com uma KeyStore carregada via código? [ carregar via Keystore.load(); ]
Qualquer luz é bem vinda…