Example usage for javax.xml.ws RespectBindingFeature isEnabled

List of usage examples for javax.xml.ws RespectBindingFeature isEnabled

Introduction

In this page you can find the example usage for javax.xml.ws RespectBindingFeature isEnabled.

Prototype

public boolean isEnabled() 

Source Link

Document

Returns true if this feature is enabled.

Usage

From source file:org.apache.axis2.jaxws.client.config.RespectBindingConfigurator.java

public void configure(MessageContext messageContext, BindingProvider provider) {
    if (log.isDebugEnabled()) {
        log.debug("Invoking RespectBindingConfiguration.configure() on client");
    }/*from w w  w. j a  va  2s  .  c  om*/
    Binding bnd = (Binding) provider.getBinding();
    RespectBindingFeature respectBindingFeature = (RespectBindingFeature) bnd
            .getFeature(RespectBindingFeature.ID);

    if (respectBindingFeature == null) {
        throw ExceptionFactory.makeWebServiceException(Messages.getMessage("respectBindingNotSpecified"));
    }
    boolean isEnabled = respectBindingFeature.isEnabled();
    if (isEnabled) {
        if (bnd instanceof SOAPBinding) {
            ((SOAPBinding) bnd).setRespectBindingEnabled(isEnabled);
        }
        //Get the wsdl document location, if wsdl is not found throw a WebservicesException.
        //If wsdl is found, look for wsdl extensions.
        EndpointDescription endpointDescription = provider.getEndpointDescription();
        endpointDescription.setRespectBinding(isEnabled);
        WSDLExtensionUtils.processExtensions(endpointDescription);

        //We have build up set of extensions from wsdl
        //let go ahead and validate these extensions now.
        EndpointDescriptionValidator endpointValidator = new EndpointDescriptionValidator(endpointDescription);

        boolean isEndpointValid = endpointValidator.validate(true);
        //throw Exception if extensions are not understood by Engine.
        if (!isEndpointValid) {
            String msg = Messages.getMessage("endpointDescriptionValidationErrors",
                    endpointValidator.toString());
            throw ExceptionFactory.makeWebServiceException(msg);
        }
    }
    if (log.isDebugEnabled()) {
        log.debug("Exit from RespectBindingConfiguration.configure() on client.");
    }
}