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


Java WebService.name方法代码示例

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


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

示例1: 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

示例2: 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

示例3: preProcessWebService

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

示例4: getUrlPatternByWebService

import javax.jws.WebService; //导入方法依赖的package包/类
public static String getUrlPatternByWebService(Class<?> beanClass){
    String urlPattern = null;
    WebService webServiceAnnotation = (WebService)beanClass.getAnnotation(WebService.class);
    if (webServiceAnnotation != null)
    {
        String name = webServiceAnnotation.name();
        urlPattern = !isEmpty(name) ? name : beanClass.getSimpleName();
        String serviceName = webServiceAnnotation.serviceName();
        if (!isEmpty(serviceName))
        {
            urlPattern = serviceName + "/" + urlPattern;
        }
    }
    return urlPattern;
}
 
开发者ID:jbossws,项目名称:jbossws-common,代码行数:16,代码来源:UrlPatternUtils.java

示例5: getServiceQname

import javax.jws.WebService; //导入方法依赖的package包/类
private QName getServiceQname(Class serviceInterface) {
    WebService webServiceAnnotation = (WebService) serviceInterface.getAnnotation(WebService.class);

    String serviceName = webServiceAnnotation.name();
    if (serviceName.startsWith("I")) {
        serviceName = serviceName.substring(1);
    }

    QName qName = new QName(webServiceAnnotation.targetNamespace(), serviceName);

    return qName;
}
 
开发者ID:BingAds,项目名称:BingAds-Java-SDK,代码行数:13,代码来源:ServiceFactoryImpl.java

示例6: getPortName

import javax.jws.WebService; //导入方法依赖的package包/类
/**
 * gets the <code>wsdl:portName</code> for a given implementation class
 * @param implClass the implementation class
 * @param targetNamespace Namespace URI for service name
 * @return the <code>wsdl:portName</code> for the <code>implClass</code>
 */
public static QName getPortName(Class<?> implClass, String targetNamespace) {
    WebService webService = implClass.getAnnotation(WebService.class);
    if (webService == null) {
        throw new RuntimeModelerException("runtime.modeler.no.webservice.annotation",
            implClass.getCanonicalName());
    }
    String name;
    if (webService.portName().length() > 0) {
        name = webService.portName();
    } else if (webService.name().length() > 0) {
        name = webService.name()+PORT;
    } else {
        name = implClass.getSimpleName()+PORT;
    }

    if (targetNamespace == null) {
        if (webService.targetNamespace().length() > 0) {
            targetNamespace = webService.targetNamespace();
        } else {
            String packageName = null;
            if (implClass.getPackage() != null) {
                packageName = implClass.getPackage().getName();
            }
            targetNamespace = getNamespace(packageName);
            if (targetNamespace == null) {
                throw new RuntimeModelerException("runtime.modeler.no.package",
                    implClass.getName());
            }
        }

    }

    return new QName(targetNamespace, name);
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:41,代码来源:RuntimeModeler.java

示例7: getPortType

import javax.jws.WebService; //导入方法依赖的package包/类
public static QName getPortType(final Class<?> seiClass) {
    final WebService webService = seiClass.getAnnotation(WebService.class);
    if (webService != null) {
        String localName = webService.name();
        if (localName == null || localName.length() == 0) {
            localName = seiClass.getSimpleName();
        }
        final String namespace = webService.targetNamespace();
        return new QName(getNamespace(seiClass, namespace), localName);
    }
    return null;
}
 
开发者ID:apache,项目名称:tomee,代码行数:13,代码来源:JaxWsUtils.java

示例8: createDDEndpoint

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

示例9: buildRuntimeModel

import javax.jws.WebService; //导入方法依赖的package包/类
/**
 * builds the runtime model from the <code>portClass</code> using the binding ID <code>bindingId</code>.
 * @return the runtime model for the <code>portClass</code>.
 */
public AbstractSEIModelImpl buildRuntimeModel() {
    model = new SOAPSEIModel(features);
    Class clazz = portClass;
    WebService webService = getPrivClassAnnotation(portClass, WebService.class);
    if (webService == null) {
        throw new RuntimeModelerException("runtime.modeler.no.webservice.annotation",
            portClass.getCanonicalName());
    }
    if (webService.endpointInterface().length() > 0) {
        clazz = getClass(webService.endpointInterface(), ModelerMessages.localizableRUNTIME_MODELER_CLASS_NOT_FOUND(webService.endpointInterface()));
        WebService seiService = getPrivClassAnnotation(clazz, WebService.class);
        if (seiService == null) {
            throw new RuntimeModelerException("runtime.modeler.endpoint.interface.no.webservice",
                webService.endpointInterface());
        }

        //check if @SOAPBinding is defined on the impl class
        SOAPBinding sbPortClass = getPrivClassAnnotation(portClass, SOAPBinding.class);
        SOAPBinding sbSei = getPrivClassAnnotation(clazz, SOAPBinding.class);
        if(sbPortClass != null){
            if(sbSei == null || sbSei.style() != sbPortClass.style()|| sbSei.use() != sbPortClass.use()){
                logger.warning(ServerMessages.RUNTIMEMODELER_INVALIDANNOTATION_ON_IMPL("@SOAPBinding", portClass.getName(), clazz.getName()));
            }
        }
    }
    if (serviceName == null)
        serviceName = getServiceName(portClass);
    model.setServiceQName(serviceName);

    String portLocalName  = portClass.getSimpleName()+PORT;
    if (webService.portName().length() >0) {
        portLocalName = webService.portName();
    } else if (webService.name().length() >0) {
        portLocalName = webService.name()+PORT;
    }

    if (portName == null)
        portName = new QName(serviceName.getNamespaceURI(), portLocalName);
    if (!portName.getNamespaceURI().equals(serviceName.getNamespaceURI())) {
        throw new RuntimeModelerException("runtime.modeler.portname.servicename.namespace.mismatch",
            serviceName, portName);
    }
    model.setPortName(portName);

    processClass(clazz);
    if (model.getJavaMethods().size() == 0)
        throw new RuntimeModelerException("runtime.modeler.no.operations",
                portClass.getName());
    model.postProcess();

    // TODO: this needs to be fixed properly --
    // when we are building RuntimeModel first before building WSDLModel,
    // we still need to do this correctyl
    if(binding!=null)
        model.freeze(binding);

    return model;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:63,代码来源:RuntimeModeler.java

示例10: processClass

import javax.jws.WebService; //导入方法依赖的package包/类
void processClass(Class clazz) {
        WebService webService = getPrivClassAnnotation(clazz, WebService.class);
        String portTypeLocalName  = clazz.getSimpleName();
        if (webService.name().length() >0)
            portTypeLocalName = webService.name();


        targetNamespace = webService.targetNamespace();
        packageName = "";
        if (clazz.getPackage() != null)
            packageName = clazz.getPackage().getName();
        if (targetNamespace.length() == 0) {
            targetNamespace = getNamespace(packageName);
        }
        model.setTargetNamespace(targetNamespace);
        QName portTypeName = new QName(targetNamespace, portTypeLocalName);
        model.setPortTypeName(portTypeName);
        model.setWSDLLocation(webService.wsdlLocation());

        SOAPBinding soapBinding = getPrivClassAnnotation(clazz, SOAPBinding.class);
        if (soapBinding != null) {
            if (soapBinding.style() == SOAPBinding.Style.RPC && soapBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE) {
                throw new RuntimeModelerException("runtime.modeler.invalid.soapbinding.parameterstyle",
                        soapBinding, clazz);

            }
            isWrapped = soapBinding.parameterStyle()== WRAPPED;
        }
        defaultBinding = createBinding(soapBinding);
        /*
         * if clazz != portClass then there is an SEI.  If there is an
         * SEI, then all methods should be processed.  However, if there is
         * no SEI, and the implementation class uses at least one
         * WebMethod annotation, then only methods with this annotation
         * will be processed.
         */
/*        if (clazz == portClass) {
            WebMethod webMethod;
            for (Method method : clazz.getMethods()) {
                webMethod = getPrivMethodAnnotation(method, WebMethod.class);
                if (webMethod != null &&
                    !webMethod.exclude()) {
                    usesWebMethod = true;
                    break;
                }
            }
        }*/

        for (Method method : clazz.getMethods()) {
            if (!clazz.isInterface()) {     // if clazz is SEI, then all methods are web methods
                if (!isWebMethodBySpec(method, clazz)) {
                    continue;
                }
            }
            // TODO: binding can be null. We need to figure out how to post-process
            // RuntimeModel to link to WSDLModel
            processMethod(method);
        }
        //Add additional jaxb classes referenced by {@link XmlSeeAlso}
        XmlSeeAlso xmlSeeAlso = getPrivClassAnnotation(clazz, XmlSeeAlso.class);
        if(xmlSeeAlso != null)
            model.addAdditionalClasses(xmlSeeAlso.value());
    }
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:64,代码来源:RuntimeModeler.java


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