当前位置: 首页>>代码示例>>Java>>正文


Java WebService类代码示例

本文整理汇总了Java中javax.jws.WebService的典型用法代码示例。如果您正苦于以下问题:Java WebService类的具体用法?Java WebService怎么用?Java WebService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WebService类属于javax.jws包,在下文中一共展示了WebService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepare

import javax.jws.WebService; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:JaxWsPortClientInterceptor.java

示例2: shouldProcessMethod

import javax.jws.WebService; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:WebServiceVisitor.java

示例3: attachWebServiceAnnotation

import javax.jws.WebService; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:JavaClassToDBCConverter.java

示例4: postProcessAfterInitialization

import javax.jws.WebService; //导入依赖的package包/类
@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;
    }
 
开发者ID:bjornharvold,项目名称:bearchoke,代码行数:23,代码来源:JaxWsBeanPostProcessor.java

示例5: verifyImplementorClass

import javax.jws.WebService; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:29,代码来源:EndpointFactory.java

示例6: getPort

import javax.jws.WebService; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:tomee,代码行数:18,代码来源:JaxWsProviderWrapper.java

示例7: findIncorrectAnnotationAndWarn

import javax.jws.WebService; //导入依赖的package包/类
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());
            }

        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:21,代码来源:CheckAnnotations.java

示例8: getPort

import javax.jws.WebService; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:tomee,代码行数:17,代码来源:ProviderWrapper.java

示例9: getName

import javax.jws.WebService; //导入依赖的package包/类
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");
}
 
开发者ID:apache,项目名称:tomee,代码行数:23,代码来源:JaxWsUtils.java

示例10: getServicePort

import javax.jws.WebService; //导入依赖的package包/类
<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);
    }
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:14,代码来源:BesDAO.java

示例11: makeAddress

import javax.jws.WebService; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:14,代码来源:EndpointExporter.java

示例12: register

import javax.jws.WebService; //导入依赖的package包/类
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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:HeidelpayResponseServlet.java

示例13: getServicePort

import javax.jws.WebService; //导入依赖的package包/类
<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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:BesDAO.java

示例14: getServicePort

import javax.jws.WebService; //导入依赖的package包/类
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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:ServiceFactory.java

示例15: applyDefaultsFromAnnotation

import javax.jws.WebService; //导入依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:JaxWsPortClientInterceptor.java


注:本文中的javax.jws.WebService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。