Skip to content

Instantly share code, notes, and snippets.

@SergioLarios
Created June 1, 2016 13:17
Show Gist options
  • Save SergioLarios/bd4fba65be7faf253099bc3b31174a7d to your computer and use it in GitHub Desktop.
Save SergioLarios/bd4fba65be7faf253099bc3b31174a7d to your computer and use it in GitHub Desktop.
package com.movistar.latam.colportal.util;
import javax.xml.ws.BindingProvider;
/**
* Utils relacionadas con las llamadas a servicios web
* @author sergio
*/
public class WsUtil {
/* ****************************
* ****** Public methods ******
* ************************** */
public static void setTiemoutEndpoint(Object port, int timeout, String endpoint) {
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
bp.getRequestContext().put(REQUEST_TIMEOUT, timeout);
bp.getRequestContext().put(CONNECT_TIMEOUT, timeout);
}
public static void setEndpoint(Object port, String endpoint) {
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
}
public static void setTiemout(Object port, int timeout) {
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(REQUEST_TIMEOUT, timeout);
bp.getRequestContext().put(CONNECT_TIMEOUT, timeout);
}
/* ****************************
* **** Private Constants *****
* ************************** */
private static final String REQUEST_TIMEOUT = "com.sun.xml.internal.ws.request.timeout";
private static final String CONNECT_TIMEOUT = "com.sun.xml.internal.ws.connect.timeout";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment