Search in sources :

Example 41 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class BindingImpl method create.

public static BindingImpl create(@NotNull BindingID bindingId, WebServiceFeature[] features) {
    // Override the BindingID from the features
    for (WebServiceFeature feature : features) {
        if (feature instanceof BindingTypeFeature) {
            BindingTypeFeature f = (BindingTypeFeature) feature;
            bindingId = BindingID.parse(f.getBindingId());
        }
    }
    if (bindingId.equals(BindingID.XML_HTTP))
        return new HTTPBindingImpl(features);
    else
        return new SOAPBindingImpl(bindingId, features);
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature) BindingTypeFeature(com.sun.xml.ws.developer.BindingTypeFeature)

Example 42 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class BindingImpl method setFaultMessageFeatures.

public void setFaultMessageFeatures(@NotNull final QName operationName, @NotNull final QName messageName, WebServiceFeature... newFeatures) {
    if (newFeatures != null) {
        final MessageKey key = new MessageKey(operationName, messageName);
        WebServiceFeatureList featureList = faultMessageFeatures.get(key);
        if (featureList == null) {
            featureList = new WebServiceFeatureList();
        }
        for (WebServiceFeature f : newFeatures) {
            featureList.add(f);
        }
        faultMessageFeatures.put(key, featureList);
    }
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Example 43 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class WebServiceFeatureList method getWebServiceFeatureBean.

private static WebServiceFeature getWebServiceFeatureBean(Annotation a) {
    WebServiceFeatureAnnotation wsfa = a.annotationType().getAnnotation(WebServiceFeatureAnnotation.class);
    Class<? extends WebServiceFeature> beanClass = wsfa.bean();
    WebServiceFeature bean;
    Constructor ftrCtr = null;
    String[] paramNames = null;
    for (Constructor con : beanClass.getConstructors()) {
        FeatureConstructor ftrCtrAnn = (FeatureConstructor) con.getAnnotation(FeatureConstructor.class);
        if (ftrCtrAnn != null) {
            if (ftrCtr == null) {
                ftrCtr = con;
                paramNames = ftrCtrAnn.value();
            } else {
                throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_MORETHANONE_FTRCONSTRUCTOR(a, beanClass));
            }
        }
    }
    if (ftrCtr == null) {
        bean = getWebServiceFeatureBeanViaBuilder(a, beanClass);
        if (bean != null) {
            return bean;
        } else {
            throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_NO_FTRCONSTRUCTOR(a, beanClass));
        }
    }
    if (ftrCtr.getParameterTypes().length != paramNames.length) {
        throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_ILLEGAL_FTRCONSTRUCTOR(a, beanClass));
    }
    try {
        Object[] params = new Object[paramNames.length];
        for (int i = 0; i < paramNames.length; i++) {
            Method m = a.annotationType().getDeclaredMethod(paramNames[i]);
            params[i] = m.invoke(a);
        }
        bean = (WebServiceFeature) ftrCtr.newInstance(params);
    } catch (Exception e) {
        throw new WebServiceException(e);
    }
    return bean;
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) FeatureConstructor(com.sun.xml.ws.api.FeatureConstructor) Constructor(java.lang.reflect.Constructor) FeatureConstructor(com.sun.xml.ws.api.FeatureConstructor) Method(java.lang.reflect.Method) RuntimeModelerException(com.sun.xml.ws.model.RuntimeModelerException) WebServiceException(jakarta.xml.ws.WebServiceException) InvocationTargetException(java.lang.reflect.InvocationTargetException) WebServiceFeatureAnnotation(jakarta.xml.ws.spi.WebServiceFeatureAnnotation) ImpliesWebServiceFeature(com.sun.xml.ws.api.ImpliesWebServiceFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) WSDLFeaturedObject(com.sun.xml.ws.api.model.wsdl.WSDLFeaturedObject)

Example 44 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class WebServiceFeatureList method parseAnnotations.

/**
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) ImpliesWebServiceFeature(com.sun.xml.ws.api.ImpliesWebServiceFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) RuntimeModelerException(com.sun.xml.ws.model.RuntimeModelerException) BindingID(com.sun.xml.ws.api.BindingID) FeatureListValidatorAnnotation(com.sun.xml.ws.api.FeatureListValidatorAnnotation) Annotation(java.lang.annotation.Annotation) WebServiceFeatureAnnotation(jakarta.xml.ws.spi.WebServiceFeatureAnnotation)

Example 45 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class BindingImpl method setOutputMessageFeatures.

public void setOutputMessageFeatures(@NotNull final QName operationName, WebServiceFeature... newFeatures) {
    if (newFeatures != null) {
        WebServiceFeatureList featureList = outputMessageFeatures.get(operationName);
        if (featureList == null) {
            featureList = new WebServiceFeatureList();
        }
        for (WebServiceFeature f : newFeatures) {
            featureList.add(f);
        }
        outputMessageFeatures.put(operationName, featureList);
    }
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Aggregations

WebServiceFeature (jakarta.xml.ws.WebServiceFeature)54 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)19 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)19 QName (javax.xml.namespace.QName)14 BindingImpl (com.sun.xml.ws.binding.BindingImpl)6 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)6 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 File (java.io.File)6 Method (java.lang.reflect.Method)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)5 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)5 URL (java.net.URL)5 Databinding (com.oracle.webservices.api.databinding.Databinding)4 DatabindingFactory (com.oracle.webservices.api.databinding.DatabindingFactory)4 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)4 ImpliesWebServiceFeature (com.sun.xml.ws.api.ImpliesWebServiceFeature)4 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)4 BindingContext (com.sun.xml.ws.spi.db.BindingContext)4