javax.xml.ws.RespectBindingFeature Java Examples

The following examples show how to use javax.xml.ws.RespectBindingFeature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JaxWsEndpointImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkRespectBindingFeature(List<ExtensibilityElement> bindingExtensors) {
    if (bindingExtensors != null) {
        Iterator<ExtensibilityElement> extensionElements = bindingExtensors.iterator();
        while (extensionElements.hasNext()) {
            ExtensibilityElement ext = extensionElements.next();
            if (ext instanceof UnknownExtensibilityElement && Boolean.TRUE.equals(ext.getRequired())
                && this.wsFeatures != null) {
                for (WebServiceFeature feature : this.wsFeatures) {
                    if (feature instanceof RespectBindingFeature && feature.isEnabled()) {

                        org.apache.cxf.common.i18n.Message message =
                            new org.apache.cxf.common.i18n.Message("UNKONWN_REQUIRED_WSDL_BINDING", LOG);
                        LOG.severe(message.toString());
                        throw new WebServiceException(message.toString());
                    }
                }
            }
        }
    }

}
 
Example #2
Source File: RespectBindingFeatureClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRespectBindingFeature() throws Exception {
    startServers("/wsdl_systest/cxf2006.wsdl");

    try {
        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class,
                                                new RespectBindingFeature(true));
        updateAddressPort(greeter, PORT);
        greeter.greetMe("hello");
        fail("WebServiceException is expected");
    } catch (javax.xml.ws.WebServiceException ex) {
        assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(),
                   ex.getMessage().indexOf("extension with required=true attribute") > -1);
    }
}
 
Example #3
Source File: RespectBindingFeatureClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testOperationRespectBindingFeature() throws Exception {
    startServers("/wsdl_systest/cxf_operation_respectbing.wsdl");

    try {
        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class,
                                                new RespectBindingFeature(true));
        updateAddressPort(greeter, PORT);
        greeter.greetMe("hello");
        fail("WebServiceException is expected");
    } catch (javax.xml.ws.WebServiceException ex) {
        assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(),
                   ex.getMessage().indexOf("extension with required=true attribute") > -1);
    }
}
 
Example #4
Source File: RespectBindingFeatureClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testOperationInputRespectBindingFeature() throws Exception {
    startServers("/wsdl_systest/cxf_operation_input_respectbing.wsdl");

    try {
        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class,
                                                new RespectBindingFeature(true));
        updateAddressPort(greeter, PORT);
        greeter.greetMe("hello");
        fail("WebServiceException is expected");
    } catch (javax.xml.ws.WebServiceException ex) {
        assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(),
                   ex.getMessage().indexOf("extension with required=true attribute") > -1);
    }
}
 
Example #5
Source File: RespectBindingFeatureClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testOperationOutputRespectBindingFeature() throws Exception {
    startServers("/wsdl_systest/cxf_operation_output_respectbing.wsdl");

    try {
        GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class,
                                                new RespectBindingFeature(true));
        updateAddressPort(greeter, PORT);
        greeter.greetMe("hello");
        fail("WebServiceException is expected");
    } catch (javax.xml.ws.WebServiceException ex) {
        assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(),
                   ex.getMessage().indexOf("extension with required=true attribute") > -1);
    }
}
 
Example #6
Source File: RespectBindingFeatureClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRespectBindingFeatureFalse() throws Exception {
    startServers("/wsdl_systest/cxf2006.wsdl");

    GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class,
                                            new RespectBindingFeature(false));
    updateAddressPort(greeter, PORT);
    assertEquals("Bonjour", greeter.sayHi());
}
 
Example #7
Source File: JaxWsServiceFactoryBean.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void loadWSFeatureAnnotation(Class<?> serviceClass, Class<?> implementorClass) {
    List<WebServiceFeature> features = new ArrayList<>();
    MTOM mtom = implInfo.getImplementorClass().getAnnotation(MTOM.class);
    if (mtom == null && serviceClass != null) {
        mtom = serviceClass.getAnnotation(MTOM.class);
    }
    if (mtom != null) {
        features.add(new MTOMFeature(mtom.enabled(), mtom.threshold()));
    } else {
        //deprecated way to set mtom
        BindingType bt = implInfo.getImplementorClass().getAnnotation(BindingType.class);
        if (bt != null
            && (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bt.value())
            || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bt.value()))) {
            features.add(new MTOMFeature(true));
        }
    }


    Addressing addressing = null;
    if (implementorClass != null) {
        addressing = implementorClass.getAnnotation(Addressing.class);
    }

    if (addressing == null && serviceClass != null) {
        addressing = serviceClass.getAnnotation(Addressing.class);
    }

    if (addressing != null) {
        features.add(new AddressingFeature(addressing.enabled(),
                                           addressing.required(),
                                           addressing.responses()));
    }

    RespectBinding respectBinding = implInfo.getImplementorClass().getAnnotation(
        RespectBinding.class);
    if (respectBinding == null && serviceClass != null) {
        respectBinding = serviceClass.getAnnotation(RespectBinding.class);
    }
    if (respectBinding != null) {
        features.add(new RespectBindingFeature(respectBinding.enabled()));
    }

    if (!features.isEmpty()) {
        wsFeatures = features;
        if (setWsFeatures != null) {
            wsFeatures.addAll(setWsFeatures);
        }
    } else {
        wsFeatures = setWsFeatures;
    }
}
 
Example #8
Source File: Stub.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #9
Source File: Stub.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #10
Source File: Stub.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #11
Source File: Stub.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #12
Source File: Stub.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #13
Source File: Stub.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #14
Source File: Stub.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}
 
Example #15
Source File: Stub.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks only if RespectBindingFeature is enabled
 * checks if all required wsdl extensions in the
 * corresponding wsdl:Port are understood when RespectBindingFeature is enabled.
 * @throws WebServiceException
 *      when any wsdl extension that has wsdl:required=true is not understood
 */
private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
    if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
        port.getPort().areRequiredExtensionsUnderstood();
    }
}