Package org.kiwiproject.jaxws
Class KiwiJaxWs
java.lang.Object
org.kiwiproject.jaxws.KiwiJaxWs
Some utilities and constants for Jakarta XML Web Services. These make use of specific features in the
JDK/Apache CXF implementation in order to provide connect and read timeouts, as well as to provide an
SSLSocketFactory. See the implementation note for more details if you are not using the JDK/Apache CXF
implementations.- See Also:
-
JAXWSProperties.CONNECT_TIMEOUTJAXWSProperties.REQUEST_TIMEOUTJAXWSProperties.SSL_SOCKET_FACTORYBindingProviderBindingProvider.ENDPOINT_ADDRESS_PROPERTYURLConnection.setConnectTimeout(int)URLConnection.setReadTimeout(int)
- Implementation Note:
- Note specifically that these use Jakarta XML Web Services vendor extension features that are
available only when using the the JDK/Apache CXF implementations. Specifically, we are using constants in
JAXWSProperties. If you are not using the JDK implementation or Apache CXF, this will almost certainly not work. For one thing you won't have JAXWSProperties in your classpath, so will most likely getNoClassDefFoundErrororClassNotFoundExceptionat runtime.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault value of the connect timeout in milliseconds.static final intDefault value of the read timeout in milliseconds. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TconfigureJdkWebService(Class<T> clazz, jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri, SSLSocketFactory sslSocketFactory, int connectTimeoutMillis, int readTimeoutMillis) Configure a JDK (e.g.static voidconfigureJdkWebServiceConnectTimeout(jakarta.xml.ws.BindingProvider bindingProvider, int connectTimeoutMillis) Configure a JDK (e.g.static voidconfigureJdkWebServiceDefaultConnectTimeout(jakarta.xml.ws.BindingProvider bindingProvider) Configure a JDK (e.g.static voidconfigureJdkWebServiceDefaultReadTimeout(jakarta.xml.ws.BindingProvider bindingProvider) Configure a JDK (e.g.static voidconfigureJdkWebServiceEndpointAddress(jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri) Configure a JDK (e.g.static voidconfigureJdkWebServiceEndpointAddress(jakarta.xml.ws.BindingProvider bindingProvider, URI serviceEndpointUri) Configure a JDK (e.g.static voidconfigureJdkWebServiceReadTimeout(jakarta.xml.ws.BindingProvider bindingProvider, int readTimeoutMillis) Configure a JDK (e.g.static voidconfigureJdkWebServiceSslSocketFactory(jakarta.xml.ws.BindingProvider bindingProvider, SSLSocketFactory sslSocketFactory) Configure a JDK (e.g.static <T> TconfigureJdkWebServiceWithDefaultTimeouts(Class<T> clazz, jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri, SSLSocketFactory sslSocketFactory) Configure a JDK (e.g.
-
Field Details
-
JAX_WS_DEFAULT_CONNECT_TIMEOUT_MILLIS
public static final int JAX_WS_DEFAULT_CONNECT_TIMEOUT_MILLISDefault value of the connect timeout in milliseconds.- See Also:
-
JAXWSProperties.CONNECT_TIMEOUTURLConnection.setConnectTimeout(int)- Constant Field Values
-
JAX_WS_DEFAULT_READ_TIMEOUT_MILLIS
public static final int JAX_WS_DEFAULT_READ_TIMEOUT_MILLISDefault value of the read timeout in milliseconds.- See Also:
-
JAXWSProperties.REQUEST_TIMEOUTURLConnection.setReadTimeout(int)- Constant Field Values
-
-
Method Details
-
configureJdkWebServiceWithDefaultTimeouts
public static <T> T configureJdkWebServiceWithDefaultTimeouts(Class<T> clazz, jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri, SSLSocketFactory sslSocketFactory) Configure a JDK (e.g. Apache CXF-based) web service class with the given service endpoint address, SSL socket factory, and default timeout values.- Type Parameters:
T- the web service type- Parameters:
clazz- the class type of the specifiedBindingProviderbindingProvider- theBindingProviderto configureserviceEndpointUri- the target service endpoint addresssslSocketFactory- the SSL socket factory to configure the web service to utilize when making secure calls- Returns:
- the configured web service
- See Also:
-
configureJdkWebService
public static <T> T configureJdkWebService(Class<T> clazz, jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri, SSLSocketFactory sslSocketFactory, int connectTimeoutMillis, int readTimeoutMillis) Configure a JDK (e.g. Apache CXF-based) web service class with the given service endpoint address, SSL socket factory, and specified connect and read timeouts (in milliseconds).- Type Parameters:
T- the web service type- Parameters:
clazz- the class type of the specifiedBindingProviderbindingProvider- theBindingProviderto configureserviceEndpointUri- the target service endpoint addresssslSocketFactory- the SSL socket factory to configure the web service to utilize when making secure callsconnectTimeoutMillis- the connect timeout in millisecondsreadTimeoutMillis- the read timeout in milliseconds- Returns:
- the configured web service
-
configureJdkWebServiceSslSocketFactory
public static void configureJdkWebServiceSslSocketFactory(jakarta.xml.ws.BindingProvider bindingProvider, SSLSocketFactory sslSocketFactory) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the given SSL socket factory. This is a non-standard property specific to the reference implementation.- Parameters:
bindingProvider- theBindingProviderto configuresslSocketFactory- the SSL socket factory to configure the web service to utilize when making secure calls- See Also:
-
JAXWSProperties.SSL_SOCKET_FACTORY
-
configureJdkWebServiceDefaultConnectTimeout
public static void configureJdkWebServiceDefaultConnectTimeout(jakarta.xml.ws.BindingProvider bindingProvider) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the default connect timeout. This is a non-standard property specific to the reference implementation.- Parameters:
bindingProvider- theBindingProviderto configure- See Also:
-
JAX_WS_DEFAULT_CONNECT_TIMEOUT_MILLISJAXWSProperties.CONNECT_TIMEOUT
-
configureJdkWebServiceConnectTimeout
public static void configureJdkWebServiceConnectTimeout(jakarta.xml.ws.BindingProvider bindingProvider, int connectTimeoutMillis) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the given connect timeout in milliseconds.- Parameters:
bindingProvider- theBindingProviderto configureconnectTimeoutMillis- the connect timeout in milliseconds- See Also:
-
JAXWSProperties.CONNECT_TIMEOUT
-
configureJdkWebServiceDefaultReadTimeout
public static void configureJdkWebServiceDefaultReadTimeout(jakarta.xml.ws.BindingProvider bindingProvider) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the default read timeout. This is a non-standard property specific to the reference implementation.- Parameters:
bindingProvider- theBindingProviderto configure- See Also:
-
JAX_WS_DEFAULT_READ_TIMEOUT_MILLISJAXWSProperties.REQUEST_TIMEOUT
-
configureJdkWebServiceReadTimeout
public static void configureJdkWebServiceReadTimeout(jakarta.xml.ws.BindingProvider bindingProvider, int readTimeoutMillis) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the given read timeout in milliseconds.- Parameters:
bindingProvider- theBindingProviderto configurereadTimeoutMillis- the read timeout in milliseconds- See Also:
-
JAXWSProperties.REQUEST_TIMEOUT
-
configureJdkWebServiceEndpointAddress
public static void configureJdkWebServiceEndpointAddress(jakarta.xml.ws.BindingProvider bindingProvider, String serviceEndpointUri) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the given service endpoint URI.- Parameters:
bindingProvider- theBindingProviderto configureserviceEndpointUri- the target service endpoint address- See Also:
-
BindingProvider.ENDPOINT_ADDRESS_PROPERTY
-
configureJdkWebServiceEndpointAddress
public static void configureJdkWebServiceEndpointAddress(jakarta.xml.ws.BindingProvider bindingProvider, URI serviceEndpointUri) Configure a JDK (e.g. Apache CXF-based) web serviceBindingProviderrequest context with the given service endpoint URI.- Parameters:
bindingProvider- theBindingProviderto configureserviceEndpointUri- the target service endpoint address- See Also:
-
BindingProvider.ENDPOINT_ADDRESS_PROPERTY
-