- Cuando se consume un servicio con HTTPS:
- Instalar el certificado desde donde se consume el servicio
- Saltarse el problema y no validar el certificado:
SSLContext sslCtx = SSLContext.getInstance("SSL");
sslCtx.init(null, new TrustManager[]{new TrustAllTrustManager()}, null);
_SATStub._getServiceClient().getOptions().setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
new Protocol("https", (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslCtx), 443));
- Configurar Timeout (Socket Timeout, Connection Timeout)
- Opción uno:
Long timeout = 30L * 1000L;
_SATStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(timeout);
- Opción dos:
Long timeout = 30L * 1000L;
_SATStub._getServiceClient().getOptions().setProperty(
HTTPConstants.SO_TIMEOUT, timeout.intValue());
_SATStub._getServiceClient().getOptions().setProperty(
HTTPConstants.SO_TIMEOUT, timeout.intValue());
_SATStub._getServiceClient().getOptions().setProperty(
HTTPConstants.CONNECTION_TIMEOUT, timeout.intValue());
- Configurar los re-intentos a cero (0).
DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(0, false);
methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
_SATStub._getServiceClient().getOptions().setProperty(
HTTPConstants.HTTP_METHOD_PARAMS, methodParams);
- Cambiar el endpoint del consumo:
_SATStub._getServiceClient().getOptions().setTo(new EndpointReference(address));
Notas y referencias:
- TrustAllTrustManager
- Welcome to Apache Axis2/Java
- How to configure timeout duration at client side for axis2 web services?
- AXIS2 How to set connection retry? Respuesta: You can set it us .....
- change the service endpoint address.
No hay comentarios:
Publicar un comentario