Java 类javax.jws.WebService 实例源码

项目:lams    文件:JaxWsPortClientInterceptor.java   
/**
 * Initialize the JAX-WS port for this interceptor.
 */
public void prepare() {
    Class<?> ifc = getServiceInterface();
    if (ifc == null) {
        throw new IllegalArgumentException("Property 'serviceInterface' is required");
    }
    WebService ann = ifc.getAnnotation(WebService.class);
    if (ann != null) {
        applyDefaultsFromAnnotation(ann);
    }
    Service serviceToUse = getJaxWsService();
    if (serviceToUse == null) {
        serviceToUse = createJaxWsService();
    }
    this.portQName = getQName(getPortName() != null ? getPortName() : getServiceInterface().getName());
    Object stub = getPortStub(serviceToUse, (getPortName() != null ? this.portQName : null));
    preparePortStub(stub);
    this.portStub = stub;
}
项目:OpenJSharp    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:openjdk-jdk10    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:openjdk9    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:spring4-understanding    文件:JaxWsPortClientInterceptor.java   
/**
 * Initialize the JAX-WS port for this interceptor.
 */
public void prepare() {
    Class<?> ifc = getServiceInterface();
    if (ifc == null) {
        throw new IllegalArgumentException("Property 'serviceInterface' is required");
    }
    WebService ann = ifc.getAnnotation(WebService.class);
    if (ann != null) {
        applyDefaultsFromAnnotation(ann);
    }
    Service serviceToUse = getJaxWsService();
    if (serviceToUse == null) {
        serviceToUse = createJaxWsService();
    }
    this.portQName = getQName(getPortName() != null ? getPortName() : getServiceInterface().getName());
    Object stub = getPortStub(serviceToUse, (getPortName() != null ? this.portQName : null));
    preparePortStub(stub);
    this.portStub = stub;
}
项目:lookaside_java-1.8.0-openjdk    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:infobip-open-jdk-8    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:class-guard    文件:JaxWsPortClientInterceptor.java   
/**
 * Initialize the JAX-WS port for this interceptor.
 */
public void prepare() {
    Class<?> ifc = getServiceInterface();
    if (ifc == null) {
        throw new IllegalArgumentException("Property 'serviceInterface' is required");
    }
    WebService ann = ifc.getAnnotation(WebService.class);
    if (ann != null) {
        applyDefaultsFromAnnotation(ann);
    }
    Service serviceToUse = getJaxWsService();
    if (serviceToUse == null) {
        serviceToUse = createJaxWsService();
    }
    this.portQName = getQName(getPortName() != null ? getPortName() : getServiceInterface().getName());
    Object stub = getPortStub(serviceToUse, (getPortName() != null ? this.portQName : null));
    preparePortStub(stub);
    this.portStub = stub;
}
项目:OLD-OpenJDK8    文件:WebServiceVisitor.java   
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
项目:wso2-axis2    文件:JavaClassToDBCConverter.java   
/**
 * This method will be used to attach @WebService annotation data to the
 * <code>DescriptionBuildercomposite</code>
 *
 * @param composite - <code>DescriptionBuilderComposite</code>
 */
private void attachWebServiceAnnotation(DescriptionBuilderComposite composite) {
    WebService webService = (WebService)ConverterUtils.getAnnotation(
            WebService.class, serviceClass);
    if (webService != null) {
        // Attach @WebService annotated data
        WebServiceAnnot wsAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
        wsAnnot.setEndpointInterface(webService.endpointInterface());
        // check for SEI and save name if necessary
        seiClassName = webService.endpointInterface();
        wsAnnot.setName(webService.name());
        wsAnnot.setPortName(webService.portName());
        wsAnnot.setServiceName(webService.serviceName());
        wsAnnot.setTargetNamespace(webService.targetNamespace());
        wsAnnot.setWsdlLocation(webService.wsdlLocation());
        composite.setWebServiceAnnot(wsAnnot);
    }
}
项目:bearchoke    文件:JaxWsBeanPostProcessor.java   
@Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (isWebService(bean)) {
            Bus bus = beanFactory.getBean(Bus.DEFAULT_BUS_ID, Bus.class);
            EndpointDefinitionParser.SpringEndpointImpl endpoint = new EndpointDefinitionParser.SpringEndpointImpl(bus, bean);

            WebService ws = bean.getClass().getAnnotation(WebService.class);
            endpoint.setAddress("/" + ws.serviceName());

            // capitalization is just a nice feature - totally optional
//            endpoint.setAddress("/" + StringUtils.capitalize(beanName));

            // adds ALL features registered / discovered by Spring
            Map<String, AbstractFeature> featureMap = beanFactory.getBeansOfType(AbstractFeature.class);
            endpoint.getFeatures().addAll(featureMap.values());

            // publish bean
            endpoint.publish();
        }

        return bean;
    }
项目:openjdk-icedtea7    文件:EndpointFactory.java   
/**
 * Verifies if the endpoint implementor class has @WebService or @WebServiceProvider
 * annotation
 *
 * @return
 *       true if it is a Provider or AsyncProvider endpoint
 *       false otherwise
 * @throws java.lang.IllegalArgumentException
 *      If it doesn't have any one of @WebService or @WebServiceProvider
 *      If it has both @WebService and @WebServiceProvider annotations
 */
public static boolean verifyImplementorClass(Class<?> clz) {
    WebServiceProvider wsProvider = clz.getAnnotation(WebServiceProvider.class);
    WebService ws = clz.getAnnotation(WebService.class);
    if (wsProvider == null && ws == null) {
        throw new IllegalArgumentException(clz +" has neither @WebService nor @WebServiceProvider annotation");
    }
    if (wsProvider != null && ws != null) {
        throw new IllegalArgumentException(clz +" has both @WebService and @WebServiceProvider annotations");
    }
    if (wsProvider != null) {
        if (Provider.class.isAssignableFrom(clz) || AsyncProvider.class.isAssignableFrom(clz)) {
            return true;
        }
        throw new IllegalArgumentException(clz +" doesn't implement Provider or AsyncProvider interface");
    }
    return false;
}
项目:tomee    文件:JaxWsProviderWrapper.java   
@Override
public <T> T getPort(final Class<T> serviceEndpointInterface) {
    final T t = serviceDelegate.getPort(serviceEndpointInterface);

    QName qname = null;
    if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) {
        final WebService webService = serviceEndpointInterface.getAnnotation(WebService.class);
        final String targetNamespace = webService.targetNamespace();
        final String name = webService.name();
        if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) {
            qname = new QName(targetNamespace, name);
        }
    }

    setProperties((BindingProvider) t, qname);
    return t;
}
项目:tomee    文件:CheckAnnotations.java   
private void findIncorrectAnnotationAndWarn(final IAnnotationFinder finder, final String component) {
    final List<Class<?>> webserviceAnnotatedClasses = finder.findAnnotatedClasses(WebService.class);
    for (final Class clazz : webserviceAnnotatedClasses) {
        final Annotation[] annotations = clazz.getDeclaredAnnotations();

        final List<Annotation> declaredAnnotations = Arrays.asList(annotations);
        for (final Annotation declaredAnn : declaredAnnotations) {
            if (declaredAnn.annotationType().getName().equals("javax.ejb.Stateful")) {
                warn(component, "annotation.invalid.stateful.webservice", clazz.getName());
            }
            if (declaredAnn.annotationType().getName().equals("javax.annotation.ManagedBean")) {
                warn(component, "annotation.invalid.managedbean.webservice", clazz.getName());
            }
            if (declaredAnn.annotationType().getName().equals("javax.ejb.MessageDriven")) {
                warn(component, "annotation.invalid.messagedriven.webservice", clazz.getName());
            }

        }
    }
}
项目:tomee    文件:ProviderWrapper.java   
public <T> T getPort(final Class<T> serviceEndpointInterface) {
    final T t = serviceDelegate.getPort(serviceEndpointInterface);

    QName qname = null;
    if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) {
        final WebService webService = serviceEndpointInterface.getAnnotation(WebService.class);
        final String targetNamespace = webService.targetNamespace();
        final String name = webService.name();
        if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) {
            qname = new QName(targetNamespace, name);
        }
    }

    setProperties((BindingProvider) t, qname);
    return customizePort(t);
}
项目:tomee    文件:JaxWsUtils.java   
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");
}
项目:oscm-app    文件:BesDAO.java   
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
            throws MalformedURLException {

        String targetNamespace = serviceClass.getAnnotation(WebService.class)
                .targetNamespace();
        QName serviceQName = new QName(targetNamespace,
                serviceClass.getSimpleName());

        Service service = createWebService(getWsdlUrl(serviceClass, settings),
                serviceQName);
//        addVersionInformation(service);
        return service.getPort(serviceClass);
    }
项目:neoscada    文件:EndpointExporter.java   
private String makeAddress ( final ServiceReference<?> reference, final Object service, final WebService webService )
{
    String serviceName = webService.serviceName ();
    if ( serviceName == null )
    {
        if ( reference.getProperty ( Constants.SERVICE_PID ) != null )
        {
            serviceName = reference.getProperty ( Constants.SERVICE_PID ).toString ();
        }
    }

    return this.baseAddress + "/" + serviceName;
}
项目:oscm    文件:HeidelpayResponseServlet.java   
String register(String wsdlUrl, RegistrationData registrationData,
        String wsUrl) throws ObjectNotFoundException, PaymentDataException,
        OperationNotPermittedException, MalformedURLException, Exception {
    PaymentRegistrationService paymentRegistrationServicePort = Service
            .create(new URL(wsdlUrl),
                    new QName(PaymentRegistrationService.class
                            .getAnnotation(WebService.class)
                            .targetNamespace(),
                            PaymentRegistrationService.class
                                    .getSimpleName())).getPort(
                    PaymentRegistrationService.class);
    setEndpointInContext(
            ((BindingProvider) paymentRegistrationServicePort), wsUrl);
    return paymentRegistrationServicePort.register(registrationData);
}
项目:oscm    文件:BesDAO.java   
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
        throws MalformedURLException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());

    Service service = createWebService(getWsdlUrl(serviceClass, settings),
            serviceQName);
    addVersionInformation(service);
    return service.getPort(serviceClass);
}
项目:oscm    文件:ServiceFactory.java   
private <T> T getServicePort(Class<T> serviceClass)
        throws ParserConfigurationException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());
    Service service = createWebService(localWSDLUrl, serviceQName);
    service = addVersionInformation(service);
    return service.getPort(
            determineEndpointReference(serviceClass.getSimpleName()),
            serviceClass);
}
项目:oscm    文件:ServiceFactory.java   
private <T> T getServicePort(Class<T> serviceClass)
        throws ParserConfigurationException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());
    Service service = createWebService(localWSDLUrl, serviceQName);
    service = addVersionInformation(service);
    return service.getPort(
            determineEndpointReference(serviceClass.getSimpleName()),
            serviceClass);
}
项目:lams    文件:JaxWsPortClientInterceptor.java   
/**
 * Initialize this client interceptor's properties from the given WebService annotation,
 * if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName"
 * and "portName" haven't been set but corresponding values are declared at the
 * annotation level of the specified service interface).
 * @param ann the WebService annotation found on the specified service interface
 */
protected void applyDefaultsFromAnnotation(WebService ann) {
    if (getWsdlDocumentUrl() == null) {
        String wsdl = ann.wsdlLocation();
        if (StringUtils.hasText(wsdl)) {
            try {
                setWsdlDocumentUrl(new URL(wsdl));
            }
            catch (MalformedURLException ex) {
                throw new IllegalStateException(
                        "Encountered invalid @Service wsdlLocation value [" + wsdl + "]", ex);
            }
        }
    }
    if (getNamespaceUri() == null) {
        String ns = ann.targetNamespace();
        if (StringUtils.hasText(ns)) {
            setNamespaceUri(ns);
        }
    }
    if (getServiceName() == null) {
        String sn = ann.serviceName();
        if (StringUtils.hasText(sn)) {
            setServiceName(sn);
        }
    }
    if (getPortName() == null) {
        String pn = ann.portName();
        if (StringUtils.hasText(pn)) {
            setPortName(pn);
        }
    }
}
项目:lams    文件:AbstractJaxWsServiceExporter.java   
/**
 * Publish all {@link javax.jws.WebService} annotated beans in the
 * containing BeanFactory.
 * @see #publishEndpoint
 */
public void publishEndpoints() {
    Set<String> beanNames = new LinkedHashSet<String>(this.beanFactory.getBeanDefinitionCount());
    beanNames.addAll(Arrays.asList(this.beanFactory.getBeanDefinitionNames()));
    if (this.beanFactory instanceof ConfigurableBeanFactory) {
        beanNames.addAll(Arrays.asList(((ConfigurableBeanFactory) this.beanFactory).getSingletonNames()));
    }
    for (String beanName : beanNames) {
        try {
            Class<?> type = this.beanFactory.getType(beanName);
            if (type != null && !type.isInterface()) {
                WebService wsAnnotation = type.getAnnotation(WebService.class);
                WebServiceProvider wsProviderAnnotation = type.getAnnotation(WebServiceProvider.class);
                if (wsAnnotation != null || wsProviderAnnotation != null) {
                    Endpoint endpoint = createEndpoint(this.beanFactory.getBean(beanName));
                    if (this.endpointProperties != null) {
                        endpoint.setProperties(this.endpointProperties);
                    }
                    if (this.executor != null) {
                        endpoint.setExecutor(this.executor);
                    }
                    if (wsAnnotation != null) {
                        publishEndpoint(endpoint, wsAnnotation);
                    }
                    else {
                        publishEndpoint(endpoint, wsProviderAnnotation);
                    }
                    this.publishedEndpoints.add(endpoint);
                }
            }
        }
        catch (CannotLoadBeanClassException ex) {
            // ignore beans where the class is not resolvable
        }
    }
}
项目:OpenJSharp    文件:WebServiceVisitor.java   
protected void verifySeiAnnotations(WebService webService, TypeElement d) {
    if (webService.endpointInterface().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(
                d.getQualifiedName(), webService.endpointInterface()), d);
    }
    if (webService.serviceName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "serviceName", d.getQualifiedName()), d);
    }
    if (webService.portName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "portName", d.getQualifiedName()), d);
    }
}
项目:OpenJSharp    文件:WebServiceVisitor.java   
protected void preProcessWebService(WebService webService, TypeElement element) {
    processedMethods = new HashSet<String>();
    seiContext = context.getSeiContext(element);
    String targetNamespace = null;
    if (webService != null)
        targetNamespace = webService.targetNamespace();
    PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element);
    if (targetNamespace == null || targetNamespace.length() == 0) {
        String packageName = packageElement.getQualifiedName().toString();
        if (packageName == null || packageName.length() == 0) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(
                    element.getQualifiedName()), element);
        }
        targetNamespace = RuntimeModeler.getNamespace(packageName);
    }
    seiContext.setNamespaceUri(targetNamespace);
    if (serviceImplName == null)
        serviceImplName = seiContext.getSeiImplName();
    if (serviceImplName != null) {
        seiContext.setSeiImplName(serviceImplName);
        context.addSeiContext(serviceImplName, seiContext);
    }
    portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_'));
    packageName = packageElement.getQualifiedName();
    portName = webService != null && webService.name() != null && webService.name().length() > 0 ?
            webService.name() : portName;
    serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue();
    serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ?
            webService.serviceName() : serviceName;
    wsdlNamespace = seiContext.getNamespaceUri();
    typeNamespace = wsdlNamespace;

    SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        pushedSoapBinding = pushSoapBinding(soapBinding, element, element);
    } else if (element.equals(typeElement)) {
        pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element);
    }
}
项目:OpenJSharp    文件:WebServiceAp.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
项目:OpenJSharp    文件:WsgenOptions.java   
/**
 * Get an implementation class annotated with @WebService annotation.
 */
private void validateEndpointClass() throws BadCommandLineException {
    Class clazz = null;
    for(String cls : endpoints){
        clazz = getClass(cls);
        if (clazz == null)
            continue;

        if (clazz.isEnum() || clazz.isInterface() ||
            clazz.isPrimitive()) {
            continue;
        }
        isImplClass = true;
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if(webService == null)
            continue;
        break;
    }
    if(clazz == null){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0)));
    }
    if(!isImplClass){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName()));
    }
    endpoint = clazz;
    validateBinding();
}
项目:Lagerta    文件:RPCServiceImpl.java   
private static Map<Class, QName> createMapping(Class... implementations) {
    Map<Class, QName> result = new HashMap<>(implementations.length);
    for (Class implementation : implementations) {
        Deque<Class> toProcess = new ArrayDeque<>();
        toProcess.add(implementation);
        Class webServiceInterface = null;
        do {
            Class clazz = toProcess.poll();
            if (clazz.getAnnotation(WebService.class) != null && clazz.isInterface()) {
                webServiceInterface = clazz;
                break;
            }
            if (clazz.getSuperclass() != null) {
                toProcess.add(clazz.getSuperclass());
            }
            if (clazz.getInterfaces() != null) {
                toProcess.addAll(Arrays.asList(clazz.getInterfaces()));
            }
        }
        while (!toProcess.isEmpty());
        if (webServiceInterface != null) {
            WebService webService = (WebService)webServiceInterface.getAnnotation(WebService.class);
            String targetNamespace = webService.targetNamespace();
            if (targetNamespace.isEmpty()) {
                targetNamespace = getDefaultTargetNamespace(implementation);
            }
            String serviceName = webService.serviceName();
            if (serviceName.isEmpty()) {
                serviceName = getDefaultServiceName(implementation);
            }
            result.put(webServiceInterface, new QName(targetNamespace, serviceName));
        }
    }
    return result;
}
项目:uavstack    文件:FastScanServlet.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    FastClasspathScanner scanner = new FastClasspathScanner("com.creditease");
    long st = System.nanoTime();
    FastClasspathScanner scannerm1 = scanner.scan();
    long end = System.nanoTime() - st;
    System.out.println(end);
    List<String> lista = scannerm1.getNamesOfClassesWithAnnotation(WebService.class);
    for (String str : lista) {
        System.out.println("webservice m1 -" + str);
    }

    st = System.nanoTime();
    FastClasspathScanner scanner2 = new FastClasspathScanner("com.creditease");
    scanner2.matchClassesWithAnnotation(WebService.class, new ClassAnnotationMatchProcessor() {

        @SuppressWarnings("rawtypes")
        @Override
        public void processMatch(Class arg0) {

            System.out.println("webservice m1 -" + arg0.getName());
        }

    }).scan();
    end = System.nanoTime() - st;
    System.out.println(end);
    resp.getWriter().write("FastClasspathScanner cost:" + end);
}
项目:jaffa-framework    文件:WebServiceInvoker.java   
/**
 * Invokes the WebService, passing it the input message.
 * @param connection the connection to use for invoking the WebService.
 * @param message the input to the WebService.
 * @return the response from the WebService.
 * @throws SOAPException if any SOAP error occurs.
 */
protected SOAPMessage invoke(SOAPConnection connection, SOAPMessage message) throws SOAPException {
    StringBuilder url = new StringBuilder(getTargetHostPlusApplication());
    if (url.charAt(url.length() - 1) != '/') {
        url.append('/');
    }
    url.append(((WebService) getWebServiceClass().getAnnotation(WebService.class)).serviceName());
    if (log.isDebugEnabled()) {
        log.debug("Invoking WebService at '" + url + "', passing " + message);
    }
    return connection.call(message, url.toString());
}
项目:openjdk-jdk10    文件:WebServiceVisitor.java   
protected void verifySeiAnnotations(WebService webService, TypeElement d) {
    if (webService.endpointInterface().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(
                d.getQualifiedName(), webService.endpointInterface()), d);
    }
    if (webService.serviceName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "serviceName", d.getQualifiedName()), d);
    }
    if (webService.portName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "portName", d.getQualifiedName()), d);
    }
}
项目:openjdk-jdk10    文件:WebServiceVisitor.java   
protected void preProcessWebService(WebService webService, TypeElement element) {
    processedMethods = new HashSet<String>();
    seiContext = context.getSeiContext(element);
    String targetNamespace = null;
    if (webService != null)
        targetNamespace = webService.targetNamespace();
    PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element);
    if (targetNamespace == null || targetNamespace.length() == 0) {
        String packageName = packageElement.getQualifiedName().toString();
        if (packageName == null || packageName.length() == 0) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(
                    element.getQualifiedName()), element);
        }
        targetNamespace = RuntimeModeler.getNamespace(packageName);
    }
    seiContext.setNamespaceUri(targetNamespace);
    if (serviceImplName == null)
        serviceImplName = seiContext.getSeiImplName();
    if (serviceImplName != null) {
        seiContext.setSeiImplName(serviceImplName);
        context.addSeiContext(serviceImplName, seiContext);
    }
    portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_'));
    packageName = packageElement.getQualifiedName();
    portName = webService != null && webService.name() != null && webService.name().length() > 0 ?
            webService.name() : portName;
    serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue();
    serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ?
            webService.serviceName() : serviceName;
    wsdlNamespace = seiContext.getNamespaceUri();
    typeNamespace = wsdlNamespace;

    SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        pushedSoapBinding = pushSoapBinding(soapBinding, element, element);
    } else if (element.equals(typeElement)) {
        pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element);
    }
}
项目:openjdk-jdk10    文件:WebServiceAp.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
项目:openjdk-jdk10    文件:WebServiceWrapperGenerator.java   
@SuppressWarnings("CallToThreadDumpStack")
protected void doPostProcessWebService(WebService webService, TypeElement d) {
    if (cm != null) {
        WsgenOptions options = builder.getOptions();
        assert options.filer != null;
        try {
            CodeWriter cw = new FilerCodeWriter(options);
            if(options.verbose)
                cw = new ProgressCodeWriter(cw, System.out);
            cm.build(cw);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
项目:openjdk-jdk10    文件:WsgenOptions.java   
/**
 * Get an implementation class annotated with @WebService annotation.
 */
private void validateEndpointClass() throws BadCommandLineException {
    Class clazz = null;
    for(String cls : endpoints){
        clazz = getClass(cls);
        if (clazz == null)
            continue;

        if (clazz.isEnum() || clazz.isInterface() ||
            clazz.isPrimitive()) {
            continue;
        }
        isImplClass = true;
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if(webService == null)
            continue;
        break;
    }
    if(clazz == null){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0)));
    }
    if(!isImplClass){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName()));
    }
    endpoint = clazz;
    validateBinding();
}
项目:openjdk9    文件:WebServiceVisitor.java   
protected void verifySeiAnnotations(WebService webService, TypeElement d) {
    if (webService.endpointInterface().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(
                d.getQualifiedName(), webService.endpointInterface()), d);
    }
    if (webService.serviceName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "serviceName", d.getQualifiedName()), d);
    }
    if (webService.portName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "portName", d.getQualifiedName()), d);
    }
}
项目:openjdk9    文件:WebServiceVisitor.java   
protected void preProcessWebService(WebService webService, TypeElement element) {
    processedMethods = new HashSet<String>();
    seiContext = context.getSeiContext(element);
    String targetNamespace = null;
    if (webService != null)
        targetNamespace = webService.targetNamespace();
    PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element);
    if (targetNamespace == null || targetNamespace.length() == 0) {
        String packageName = packageElement.getQualifiedName().toString();
        if (packageName == null || packageName.length() == 0) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(
                    element.getQualifiedName()), element);
        }
        targetNamespace = RuntimeModeler.getNamespace(packageName);
    }
    seiContext.setNamespaceUri(targetNamespace);
    if (serviceImplName == null)
        serviceImplName = seiContext.getSeiImplName();
    if (serviceImplName != null) {
        seiContext.setSeiImplName(serviceImplName);
        context.addSeiContext(serviceImplName, seiContext);
    }
    portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_'));
    packageName = packageElement.getQualifiedName();
    portName = webService != null && webService.name() != null && webService.name().length() > 0 ?
            webService.name() : portName;
    serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue();
    serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ?
            webService.serviceName() : serviceName;
    wsdlNamespace = seiContext.getNamespaceUri();
    typeNamespace = wsdlNamespace;

    SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        pushedSoapBinding = pushSoapBinding(soapBinding, element, element);
    } else if (element.equals(typeElement)) {
        pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element);
    }
}
项目:openjdk9    文件:WebServiceAp.java   
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
项目:openjdk9    文件:WsgenOptions.java   
/**
 * Get an implementation class annotated with @WebService annotation.
 */
private void validateEndpointClass() throws BadCommandLineException {
    Class clazz = null;
    for(String cls : endpoints){
        clazz = getClass(cls);
        if (clazz == null)
            continue;

        if (clazz.isEnum() || clazz.isInterface() ||
            clazz.isPrimitive()) {
            continue;
        }
        isImplClass = true;
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if(webService == null)
            continue;
        break;
    }
    if(clazz == null){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0)));
    }
    if(!isImplClass){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName()));
    }
    endpoint = clazz;
    validateBinding();
}