Created
June 1, 2016 13:17
-
-
Save SergioLarios/bd4fba65be7faf253099bc3b31174a7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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