Search in sources :

Example 6 with WebServiceFeature

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

the class WebServiceFeatureList method getWebServiceFeatureBeanViaBuilder.

private static WebServiceFeature getWebServiceFeatureBeanViaBuilder(final Annotation annotation, final Class<? extends WebServiceFeature> beanClass) {
    try {
        final Method featureBuilderMethod = beanClass.getDeclaredMethod("builder");
        final Object builder = featureBuilderMethod.invoke(beanClass);
        final Method buildMethod = builder.getClass().getDeclaredMethod("build");
        for (Method builderMethod : builder.getClass().getDeclaredMethods()) {
            if (!builderMethod.equals(buildMethod) && !builderMethod.isSynthetic()) {
                final String methodName = builderMethod.getName();
                final Method annotationMethod = annotation.annotationType().getDeclaredMethod(methodName);
                final Object annotationFieldValue = annotationMethod.invoke(annotation);
                final Object[] arg = { annotationFieldValue };
                if (skipDuringOrgJvnetWsToComOracleWebservicesPackageMove(builderMethod, annotationFieldValue)) {
                    continue;
                }
                builderMethod.invoke(builder, arg);
            }
        }
        final Object result = buildMethod.invoke(builder);
        if (result instanceof WebServiceFeature) {
            return (WebServiceFeature) result;
        } else {
            throw new WebServiceException("Not a WebServiceFeature: " + result);
        }
    } catch (final NoSuchMethodException e) {
        LOGGER.log(Level.INFO, "Unable to find builder method on webservice feature: " + beanClass.getName(), e);
        return null;
    } catch (final IllegalAccessException | InvocationTargetException e) {
        throw new WebServiceException(e);
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) ImpliesWebServiceFeature(com.sun.xml.ws.api.ImpliesWebServiceFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) WSDLFeaturedObject(com.sun.xml.ws.api.model.wsdl.WSDLFeaturedObject) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 7 with WebServiceFeature

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

the class WebServiceFeatureList method getFeature.

/**
 * Returns a corresponding feature for a feature annotation(i.e which has
 * {@link WebServiceFeatureAnnotation} meta annotation)
 *
 * @return corresponding feature for the annotation
 *         null, if the annotation is nota feature annotation
 */
public static WebServiceFeature getFeature(Annotation a) {
    WebServiceFeature ftr = null;
    if (!(a.annotationType().isAnnotationPresent(WebServiceFeatureAnnotation.class))) {
        ftr = null;
    } else if (a instanceof Addressing) {
        Addressing addAnn = (Addressing) a;
        try {
            ftr = new AddressingFeature(addAnn.enabled(), addAnn.required(), addAnn.responses());
        } catch (NoSuchMethodError e) {
            // throw error. We can't default to Responses.ALL as we dont know if the user has not used 2.2 annotation with responses.
            throw new RuntimeModelerException(ModelerMessages.RUNTIME_MODELER_ADDRESSING_RESPONSES_NOSUCHMETHOD(toJar(Which.which(Addressing.class))));
        }
    } else if (a instanceof MTOM) {
        MTOM mtomAnn = (MTOM) a;
        ftr = new MTOMFeature(mtomAnn.enabled(), mtomAnn.threshold());
    } else if (a instanceof RespectBinding) {
        RespectBinding rbAnn = (RespectBinding) a;
        ftr = new RespectBindingFeature(rbAnn.enabled());
    } else {
        ftr = getWebServiceFeatureBean(a);
    }
    return ftr;
}
Also used : MTOM(jakarta.xml.ws.soap.MTOM) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) RespectBindingFeature(jakarta.xml.ws.RespectBindingFeature) ImpliesWebServiceFeature(com.sun.xml.ws.api.ImpliesWebServiceFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) RespectBinding(jakarta.xml.ws.RespectBinding) RuntimeModelerException(com.sun.xml.ws.model.RuntimeModelerException) Addressing(jakarta.xml.ws.soap.Addressing)

Example 8 with WebServiceFeature

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

the class PortInfo method createBinding.

public BindingImpl createBinding(WebServiceFeatureList webServiceFeatures, Class<?> portInterface, BindingImpl existingBinding) {
    if (existingBinding != null) {
        webServiceFeatures.addAll(existingBinding.getFeatures());
    }
    Iterable<WebServiceFeature> configFeatures;
    // Even in case of Dispatch, merge all features configured via WSDL/Policy or deployment configuration
    if (portModel != null) {
        // could have merged features from this.policyMap, but some features are set in WSDLModel which are not there in PolicyMap
        // for ex: <wsaw:UsingAddressing> wsdl extn., and since the policyMap features are merged into WSDLModel anyway during postFinished(),
        // So, using here WsdlModel for merging is right.
        // merge features from WSDL
        configFeatures = portModel.getFeatures();
    } else {
        configFeatures = PolicyUtil.getPortScopedFeatures(policyMap, owner.getServiceName(), portName);
    }
    webServiceFeatures.mergeFeatures(configFeatures, false);
    // merge features from interceptor
    webServiceFeatures.mergeFeatures(owner.serviceInterceptor.preCreateBinding(this, portInterface, webServiceFeatures), false);
    BindingImpl bindingImpl = BindingImpl.create(bindingId, webServiceFeatures.toArray());
    owner.getHandlerConfigurator().configureHandlers(this, bindingImpl);
    return bindingImpl;
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Example 9 with WebServiceFeature

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

the class SDODatabindingTestBase method invmSetup.

protected WebServiceFeature[] invmSetup(final URL wsdlURL, final Class sei, final Class seb, final QName serviceName, final QName portName) {
    DatabindingModeFeature dbmf = new DatabindingModeFeature("eclipselink.sdo");
    Class implementorClass = seb;
    boolean handlersSetInDD = false;
    Container container = Container.NONE;
    Map<String, SDDocumentSource> docs = new HashMap<String, SDDocumentSource>();
    SDDocumentSource primaryWSDL = SDDocumentSource.create(wsdlURL);
    docs.put(wsdlURL.toString(), primaryWSDL);
    ExternalMetadataFeature exm = ExternalMetadataFeature.builder().setReader(new com.sun.xml.ws.model.ReflectAnnotationReader() {

        public <A extends Annotation> A getAnnotation(final Class<A> annType, final Class<?> cls) {
            if (WebService.class.equals(annType)) {
                final WebService ws = cls.getAnnotation(WebService.class);
                return (A) new jakarta.jws.WebService() {

                    public Class<? extends Annotation> annotationType() {
                        return WebService.class;
                    }

                    @Override
                    public String endpointInterface() {
                        return sei.getName();
                    }

                    @Override
                    public String name() {
                        return (ws != null) ? ws.name() : null;
                    }

                    @Override
                    public String portName() {
                        return (ws != null) ? ws.portName() : null;
                    }

                    @Override
                    public String serviceName() {
                        return (ws != null) ? ws.serviceName() : null;
                    }

                    @Override
                    public String targetNamespace() {
                        return (ws != null) ? ws.targetNamespace() : null;
                    }

                    @Override
                    public String wsdlLocation() {
                        return (ws != null) ? ws.wsdlLocation() : null;
                    }
                };
            }
            return cls.getAnnotation(annType);
        }
    }).build();
    BindingID bindingID = BindingID.parse(implementorClass);
    WSBinding binding = bindingID.createBinding(dbmf, exm);
    final WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass, !handlersSetInDD, null, serviceName, portName, container, binding, primaryWSDL, docs.values(), XmlUtil.createEntityResolver(null), false);
    ComponentFeature cf = new ComponentFeature(new com.sun.xml.ws.api.Component() {

        public <S> S getSPI(Class<S> spiType) {
            if (TransportTubeFactory.class.equals(spiType))
                return (S) new TransportTubeFactory() {

                    public Tube doCreate(ClientTubeAssemblerContext context) {
                        return new InVmTransportTube(context.getCodec(), context.getBinding(), wsdlURL, endpoint);
                    }
                };
            return null;
        }
    });
    WebServiceFeature[] f = { dbmf, cf };
    return f;
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) Tube(com.sun.xml.ws.api.pipe.Tube) HashMap(java.util.HashMap) WebService(jakarta.jws.WebService) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) BindingID(com.sun.xml.ws.api.BindingID) TransportTubeFactory(com.sun.xml.ws.api.pipe.TransportTubeFactory) Container(com.sun.xml.ws.api.server.Container) SDDocumentSource(com.sun.xml.ws.api.server.SDDocumentSource) Annotation(java.lang.annotation.Annotation) ExternalMetadataFeature(com.oracle.webservices.api.databinding.ExternalMetadataFeature) WebService(jakarta.jws.WebService) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) ComponentFeature(com.sun.xml.ws.api.ComponentFeature) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 10 with WebServiceFeature

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

the class SDODatabindingTestBase method createProxy.

public static <T> T createProxy(Class<T> proxySEI, Class<?> endpointClass, String db, boolean debug) throws Exception {
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    DatabindingModeFeature dbf = new DatabindingModeFeature(db);
    WebServiceFeatureList wsfeatures = new WebServiceFeatureList(endpointClass);
    WebServiceFeature[] f = { dbf };
    // config.setFeatures(wsfeatures.toArray());
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(proxySEI);
    cliConfig.setFeatures(f);
    return createProxy(proxySEI, srvConfig, cliConfig, debug);
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) WebServiceFeatureList(com.sun.xml.ws.binding.WebServiceFeatureList)

Aggregations

WebServiceFeature (jakarta.xml.ws.WebServiceFeature)52 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)19 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)19 QName (javax.xml.namespace.QName)13 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 Map (java.util.Map)6 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)5 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)5 HashMap (java.util.HashMap)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 HelperContext (commonj.sdo.helper.HelperContext)4