Search in sources :

Example 6 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project tomee by apache.

the class JaxWsUtils method getName.

public static String getName(final Class<?> clazz) {
    final WebService webService = clazz.getAnnotation(WebService.class);
    if (webService != null) {
        final String sei = webService.endpointInterface();
        if (sei != null && sei.trim().length() != 0) {
            try {
                final Class seiClass = clazz.getClassLoader().loadClass(sei.trim());
                return getNameFromInterface(seiClass);
            } catch (final ClassNotFoundException e) {
                throw new OpenEJBRuntimeException("Unable to load SEI class: " + sei, e);
            }
        }
        return getName(clazz, webService.name());
    }
    final WebServiceProvider webServiceProvider = clazz.getAnnotation(WebServiceProvider.class);
    if (webServiceProvider != null) {
        return clazz.getName();
    }
    throw new IllegalArgumentException("The " + clazz.getName() + " is not annotated");
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) WebServiceProvider(javax.xml.ws.WebServiceProvider) WebService(javax.jws.WebService)

Example 7 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project camel by apache.

the class CxfEndpoint method setupServerFactoryBean.

/**
     * Populate server factory bean
     */
protected void setupServerFactoryBean(ServerFactoryBean sfb, Class<?> cls) {
    // address
    sfb.setAddress(getAddress());
    sfb.setServiceClass(cls);
    sfb.setInInterceptors(in);
    sfb.setOutInterceptors(out);
    sfb.setOutFaultInterceptors(outFault);
    sfb.setInFaultInterceptors(inFault);
    sfb.setFeatures(features);
    if (schemaLocations != null) {
        sfb.setSchemaLocations(schemaLocations);
    }
    if (bindingConfig != null) {
        sfb.setBindingConfig(bindingConfig);
    }
    if (dataBinding != null) {
        sfb.setDataBinding(dataBinding);
    }
    if (serviceFactoryBean != null) {
        setServiceFactory(sfb, serviceFactoryBean);
    }
    if (sfb instanceof JaxWsServerFactoryBean && handlers != null) {
        ((JaxWsServerFactoryBean) sfb).setHandlers(handlers);
    }
    if (getTransportId() != null) {
        sfb.setTransportId(getTransportId());
    }
    if (getBindingId() != null) {
        sfb.setBindingId(getBindingId());
    }
    // wsdl url
    if (getWsdlURL() != null) {
        sfb.setWsdlURL(getWsdlURL());
    }
    // service  name qname
    if (getServiceName() != null) {
        sfb.setServiceName(getServiceName());
    }
    // port qname
    if (getPortName() != null) {
        sfb.setEndpointName(getPortName());
    }
    // apply feature here
    if (!CxfEndpointUtils.hasAnnotation(cls, WebServiceProvider.class)) {
        if (getDataFormat() == DataFormat.PAYLOAD) {
            sfb.getFeatures().add(new PayLoadDataFormatFeature(allowStreaming));
        } else if (getDataFormat().dealias() == DataFormat.CXF_MESSAGE) {
            sfb.getFeatures().add(new CXFMessageDataFormatFeature());
            sfb.setDataBinding(new SourceDataBinding());
        } else if (getDataFormat().dealias() == DataFormat.RAW) {
            RAWDataFormatFeature feature = new RAWDataFormatFeature();
            if (this.getExchangePattern().equals(ExchangePattern.InOnly)) {
                //if DataFormat is RAW|MESSAGE, can't read message so can't
                //determine it's oneway so need get the MEP from URI explicitly
                feature.setOneway(true);
            }
            feature.addInIntercepters(getInInterceptors());
            feature.addOutInterceptors(getOutInterceptors());
            sfb.getFeatures().add(feature);
        }
    } else {
        LOG.debug("Ignore DataFormat mode {} since SEI class is annotated with WebServiceProvider", getDataFormat());
    }
    if (isLoggingFeatureEnabled()) {
        if (getLoggingSizeLimit() != 0) {
            sfb.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
        } else {
            sfb.getFeatures().add(new LoggingFeature());
        }
    }
    if (getDataFormat() == DataFormat.PAYLOAD) {
        sfb.setDataBinding(new HybridSourceDataBinding());
    }
    // set the document-literal wrapped style
    if (getWrappedStyle() != null && getDataFormat().dealias() != DataFormat.CXF_MESSAGE) {
        setWrapped(sfb, getWrappedStyle());
    }
    // any optional properties
    if (getProperties() != null) {
        if (sfb.getProperties() != null) {
            // add to existing properties
            sfb.getProperties().putAll(getProperties());
        } else {
            sfb.setProperties(getProperties());
        }
        LOG.debug("ServerFactoryBean: {} added properties: {}", sfb, getProperties());
    }
    if (this.isSkipPayloadMessagePartCheck()) {
        if (sfb.getProperties() == null) {
            sfb.setProperties(new HashMap<String, Object>());
        }
        sfb.getProperties().put("soap.no.validate.parts", Boolean.TRUE);
    }
    if (this.isSkipFaultLogging()) {
        if (sfb.getProperties() == null) {
            sfb.setProperties(new HashMap<String, Object>());
        }
        sfb.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
    }
    sfb.setBus(getBus());
    sfb.setStart(false);
    getNullSafeCxfEndpointConfigurer().configure(sfb);
}
Also used : RAWDataFormatFeature(org.apache.camel.component.cxf.feature.RAWDataFormatFeature) FaultListener(org.apache.cxf.logging.FaultListener) SourceDataBinding(org.apache.cxf.databinding.source.SourceDataBinding) WebServiceProvider(javax.xml.ws.WebServiceProvider) LoggingFeature(org.apache.cxf.feature.LoggingFeature) PayLoadDataFormatFeature(org.apache.camel.component.cxf.feature.PayLoadDataFormatFeature) CXFMessageDataFormatFeature(org.apache.camel.component.cxf.feature.CXFMessageDataFormatFeature) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 8 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_POJO method exclude.

private boolean exclude(final DeploymentUnit unit, final EEModuleClassDescription classDescription) {
    // exclude if it's Enterprise Beans 3 and Jakarta Messaging endpoint
    ClassInfo classInfo = null;
    ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription.getAnnotationInformation(WebService.class);
    if (annotationInfo != null) {
        classInfo = (ClassInfo) annotationInfo.getClassLevelAnnotations().get(0).getTarget();
    } else {
        ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> providreInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
        classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
    }
    if (isEjb3(classInfo) || isJmsEndpoint(unit, classInfo)) {
        return true;
    }
    return false;
}
Also used : WebServiceProvider(javax.xml.ws.WebServiceProvider) WebService(javax.jws.WebService) ClassInfo(org.jboss.jandex.ClassInfo)

Example 9 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project tomee by apache.

the class JaxWsUtils method getPortQName.

public static QName getPortQName(final Class<?> clazz) {
    final WebService webService = clazz.getAnnotation(WebService.class);
    if (webService != null) {
        return getPortQName(clazz, webService.targetNamespace(), webService.name(), webService.portName());
    }
    final WebServiceProvider webServiceProvider = clazz.getAnnotation(WebServiceProvider.class);
    if (webServiceProvider != null) {
        return getPortQName(clazz, webServiceProvider.targetNamespace(), null, webServiceProvider.portName());
    }
    throw new IllegalArgumentException("The " + clazz.getName() + " is not annotated");
}
Also used : WebServiceProvider(javax.xml.ws.WebServiceProvider) WebService(javax.jws.WebService)

Example 10 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project tomee by apache.

the class JaxWsUtils method getServiceQName.

public static QName getServiceQName(final Class<?> clazz) {
    final WebService webService = clazz.getAnnotation(WebService.class);
    if (webService != null) {
        return getServiceQName(clazz, webService.targetNamespace(), webService.serviceName());
    }
    final WebServiceProvider webServiceProvider = clazz.getAnnotation(WebServiceProvider.class);
    if (webServiceProvider != null) {
        return getServiceQName(clazz, webServiceProvider.targetNamespace(), webServiceProvider.serviceName());
    }
    final WebServiceClient webServiceClient = clazz.getAnnotation(WebServiceClient.class);
    if (webServiceClient != null) {
        return getServiceQName(clazz, webServiceClient.targetNamespace(), webServiceClient.name());
    }
    throw new IllegalArgumentException("The " + clazz.getName() + " is not annotated");
}
Also used : WebServiceProvider(javax.xml.ws.WebServiceProvider) WebService(javax.jws.WebService) WebServiceClient(javax.xml.ws.WebServiceClient)

Aggregations

WebServiceProvider (javax.xml.ws.WebServiceProvider)11 WebService (javax.jws.WebService)10 ClassInfo (org.jboss.jandex.ClassInfo)4 WebServiceClient (javax.xml.ws.WebServiceClient)2 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)2 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)2 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)2 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)2 POJOEndpoint (org.jboss.as.webservices.metadata.model.POJOEndpoint)2 JBossWebMetaData (org.jboss.metadata.web.jboss.JBossWebMetaData)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 QName (javax.xml.namespace.QName)1 Endpoint (javax.xml.ws.Endpoint)1 CXFMessageDataFormatFeature (org.apache.camel.component.cxf.feature.CXFMessageDataFormatFeature)1 PayLoadDataFormatFeature (org.apache.camel.component.cxf.feature.PayLoadDataFormatFeature)1 RAWDataFormatFeature (org.apache.camel.component.cxf.feature.RAWDataFormatFeature)1 SourceDataBinding (org.apache.cxf.databinding.source.SourceDataBinding)1 LoggingFeature (org.apache.cxf.feature.LoggingFeature)1