Search in sources :

Example 11 with WebServiceProvider

use of javax.xml.ws.WebServiceProvider in project jbossws-cxf by jbossws.

the class MetadataBuilder method createDDEndpoint.

protected DDEndpoint createDDEndpoint(Class<?> sepClass, ArchiveDeployment dep, Endpoint ep) {
    WebService anWebService = sepClass.getAnnotation(WebService.class);
    WebServiceProvider anWebServiceProvider = sepClass.getAnnotation(WebServiceProvider.class);
    Class<?> seiClass = null;
    String seiName;
    String name = (anWebService != null) ? anWebService.name() : "";
    if (name.length() == 0)
        name = JavaUtils.getJustClassName(sepClass);
    String serviceName = (anWebService != null) ? anWebService.serviceName() : anWebServiceProvider.serviceName();
    if (serviceName.length() == 0) {
        serviceName = JavaUtils.getJustClassName(sepClass) + "Service";
    }
    String serviceNS = (anWebService != null) ? anWebService.targetNamespace() : anWebServiceProvider.targetNamespace();
    if (serviceNS.length() == 0)
        serviceNS = getTypeNamespace(JavaUtils.getPackageName(sepClass));
    String portName = (anWebService != null) ? anWebService.portName() : anWebServiceProvider.portName();
    if (portName.length() == 0) {
        portName = name + "Port";
    }
    String annWsdlLocation;
    if (anWebService != null && anWebService.endpointInterface().length() > 0) {
        seiName = anWebService.endpointInterface();
        ClassLoader runtimeClassLoader = dep.getClassLoader();
        if (null == runtimeClassLoader)
            throw MESSAGES.runtimeLoaderCannotBeNull(dep);
        try {
            seiClass = runtimeClassLoader.loadClass(seiName);
        } catch (ClassNotFoundException cnfe) {
            throw new RuntimeException(cnfe);
        }
        WebService seiAnnotation = seiClass.getAnnotation(WebService.class);
        if (seiAnnotation == null)
            throw MESSAGES.webserviceAnnotationNotFound(seiName);
        if (seiAnnotation.portName().length() > 0 || seiAnnotation.serviceName().length() > 0 || seiAnnotation.endpointInterface().length() > 0)
            throw MESSAGES.webserviceAnnotationSEIAttributes(seiName);
        annWsdlLocation = !"".equals(anWebService.wsdlLocation()) ? anWebService.wsdlLocation() : seiAnnotation.wsdlLocation();
    } else {
        annWsdlLocation = (anWebService != null) ? anWebService.wsdlLocation() : anWebServiceProvider.wsdlLocation();
    }
    DDEndpoint result = new DDEndpoint();
    result.setId(ep.getShortName());
    result.setAddress(SysPropUtils.expandSystemProperty(ep.getAddress()));
    result.setImplementor(ep.getTargetBeanName());
    result.setMtomEnabled(isMtomEnabled(ep.getTargetBeanClass()));
    result.setEpClass(seiClass != null ? seiClass : sepClass);
    result.setPortName(new QName(serviceNS, portName));
    result.setServiceName(new QName(serviceNS, serviceName));
    if (annWsdlLocation.length() > 0) {
        result.setAnnotationWsdlLocation(annWsdlLocation);
    }
    return result;
}
Also used : WebServiceProvider(javax.xml.ws.WebServiceProvider) DDEndpoint(org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint) WebService(javax.jws.WebService) QName(javax.xml.namespace.QName)

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