Class WebserviceUtils


  • public class WebserviceUtils
    extends Object
    Utility class around webservices.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • WebserviceUtils

        public WebserviceUtils()
    • Method Detail

      • enableSchemaValidation

        public static void enableSchemaValidation​(BindingProvider provider)
        Enables the schema validation.
        Parameters:
        provider - the webservice to enable schema validation for
      • disableSchemaValidation

        public static void disableSchemaValidation​(BindingProvider provider)
        Disables the schema validation.
        Parameters:
        provider - the webservice to disable schema validation for
      • configureClient

        public static void configureClient​(adams.flow.core.Actor owner,
                                           Object servicePort,
                                           int connection,
                                           int receive,
                                           String url,
                                           AbstractInInterceptorGenerator inInterceptor,
                                           AbstractOutInterceptorGenerator outInterceptor)
        Sets the timeouts for connection and receiving. Also configures the proxy settings in case there is a system-wide proxy configured. Automatically configures TLS if present in actor's context.
        Parameters:
        owner - the owning actor
        servicePort - the service port to set the timeouts for
        connection - the timeout for the connection in msec, 0 is infinite
        receive - the timeout for receiving in msec, 0 is infinite
        url - the URL of the webservice, null to use default
        inInterceptor - the interceptor for incoming messages, null if not available
        outInterceptor - the interceptor for outcoing messages, null if not available
        See Also:
        ProxyHelper
      • configureServiceInterceptors

        public static void configureServiceInterceptors​(adams.flow.core.Actor owner,
                                                        org.apache.cxf.jaxws.EndpointImpl endpoint,
                                                        AbstractInInterceptorGenerator inInterceptor,
                                                        AbstractOutInterceptorGenerator outInterceptor)
        Configures the interceptors/logging for the service endpoint (incoming and outgoing).
        Parameters:
        owner - the owning actor
        endpoint - the endpoint to configure
        inInterceptor - the interceptor for incoming messages
        outInterceptor - the interceptor for outcoing messages
      • loadWsdl

        public static String loadWsdl​(URL location)
        Loads the WSDL from the given location.
        Parameters:
        location - the location of the WSDL
        Returns:
        the content of the WSDL, null if failed to load
      • wsdlToHtml

        public static String wsdlToHtml​(String wsdl)
        Turns the WSDL content into content to be displayed as HTML.
        Parameters:
        wsdl - the WSDL to convert
        Returns:
        the HTML code
      • copyImplementation

        public static Object copyImplementation​(Object implementation)
        Creates a copy of the WS implementation, either using a shallow copy (if implementing OptionHandler) or ClassManager.deepCopy(Object).
        Parameters:
        implementation - the webservice implemntation to copy
        Returns:
        the copy, null if failed to copy