Example usage for javax.xml.ws RespectBindingFeature ID

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

Introduction

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

Prototype

String ID

To view the source code for javax.xml.ws RespectBindingFeature ID.

Click Source Link

Document

Constant value identifying the RespectBindingFeature

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");
    }// w  w w . j  a  va  2s  .co  m
    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.");
    }
}

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

public void configure(EndpointDescription endpointDescription) {
    if (log.isDebugEnabled()) {
        log.debug("Invoking RespectBindingConfiguration.configure() on Server");
    }/*from  w w w . j a va2s .c  o  m*/
    RespectBinding annotation = (RespectBinding) ((EndpointDescriptionJava) endpointDescription)
            .getAnnoFeature(RespectBindingFeature.ID);

    if (annotation != null) {
        if (log.isDebugEnabled()) {
            log.debug("Setting respectBinding to " + annotation.enabled());
        }
        endpointDescription.setRespectBinding(annotation.enabled());

        // Once we know that @RespectBinding is enabled, we have to find
        // any binding extensibility elements available and see which ones
        // have the "required" flag set to true.
        EndpointDescriptionWSDL edw = (EndpointDescriptionWSDL) endpointDescription;
        Binding bnd = edw.getWSDLBinding();
        Set<WSDLValidatorElement> requiredExtension = endpointDescription.getRequiredBindings();
        List<QName> unusedExtensions = new ArrayList<QName>();
        //invoke the search algorithm.
        WSDLExtensionUtils.search(bnd, requiredExtension, unusedExtensions);

        if (log.isDebugEnabled()) {
            log.debug("The following extensibility elements were found, but were not required.");
            for (int n = 0; n < unusedExtensions.size(); ++n)
                log.debug("[" + (n + 1) + "] - " + unusedExtensions.get(n));
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("No @RespectBinding annotation was found.");
        }
    }
    if (log.isDebugEnabled()) {
        log.debug("Exit from RespectBindingConfiguration.configure() on Server.");
    }
}