javax.xml.ws.soap.Addressing Java Examples

The following examples show how to use javax.xml.ws.soap.Addressing. 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 String getAddressingRequirement(Addressing addressing) {
    try {
        Object o = Addressing.class.getMethod("responses").invoke(addressing);
        if (o != null) {
            String s = o.toString();
            if ("ANONYMOUS".equals(s)) {
                return "AnonymousResponses";
            } else if ("NON_ANONYMOUS".equals(s)) {
                return "NonAnonymousResponses";
            }
        }
    } catch (Throwable ex) {
        //ignore - probably JAX-WS 2.1
    }
    return null;
}
 
Example #2
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;
    }
}