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


Java WebService.serviceName方法代码示例

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


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

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

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

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

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

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

示例6: getServiceName

import javax.jws.WebService; //导入方法依赖的package包/类
/**
 * gets the <code>wsdl:serviceName</code> for a given implementation class
 * @param implClass the implementation class
 * @return the <code>wsdl:serviceName</code> for the <code>implClass</code>
 */
public static QName getServiceName(Class<?> implClass) {
    if (implClass.isInterface()) {
        throw new RuntimeModelerException("runtime.modeler.cannot.get.serviceName.from.interface",
                                implClass.getCanonicalName());
    }

    String name = implClass.getSimpleName()+SERVICE;
    String packageName = "";
    if (implClass.getPackage() != null)
        packageName = implClass.getPackage().getName();

    WebService webService = implClass.getAnnotation(WebService.class);
    if (webService == null) {
        throw new RuntimeModelerException("runtime.modeler.no.webservice.annotation",
            implClass.getCanonicalName());
    }
    if (webService.serviceName().length() > 0) {
        name = webService.serviceName();
    }
    String targetNamespace = getNamespace(packageName);
    if (webService.targetNamespace().length() > 0) {
        targetNamespace = webService.targetNamespace();
    } else if (targetNamespace == null) {
        throw new RuntimeModelerException("runtime.modeler.no.package",
            implClass.getName());
    }



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

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

示例8: getWebServiceAnnotation

import javax.jws.WebService; //导入方法依赖的package包/类
@Override
public WebServiceAnnotation getWebServiceAnnotation(Class<?> clazz) {
    WebService annotation = clazz.getAnnotation(WebService.class);
    return annotation == null ? null : new WebServiceAnnotation(annotation.targetNamespace(),
            annotation.serviceName());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:7,代码来源:JSR181HelperImpl.java


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