javax.jws.WebService.wsdlLocation()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中javax.jws.WebService.wsdlLocation()方法的一些代码示例,展示了WebService.wsdlLocation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebService.wsdlLocation()方法的具体详情如下:
包路径:javax.jws.WebService
类名称:WebService
方法名:wsdlLocation

WebService.wsdlLocation介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

String wsdl = ann.wsdlLocation();
if (StringUtils.hasText(wsdl)) {
  try {

代码示例来源:origin: org.springframework/spring-web

String wsdl = ann.wsdlLocation();
if (StringUtils.hasText(wsdl)) {
  try {

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

public String getWsdlLocation() {
  for (WebService service : wsAnnotations) {
    if (!StringUtils.isEmpty(service.wsdlLocation())) {
      return service.wsdlLocation();
    }
  }
  if (null != wsProviderAnnotation
    && !StringUtils.isEmpty(wsProviderAnnotation.wsdlLocation())) {
    return wsProviderAnnotation.wsdlLocation();
  }
  return null;
}

代码示例来源:origin: kumuluz/kumuluzee

public String wsdlLocation() {
  if (ws == null) {
    return null;
  }
  return ws.wsdlLocation() != null && ws.wsdlLocation().isEmpty() ? null : ws.wsdlLocation();
}

代码示例来源:origin: org.objectweb.celtix/celtix-rt

private URL getWsdlLocation(WebService wsAnnotation) {
  URL url = null;
  if (wsAnnotation != null) {
    try {
      url = new URL(wsAnnotation.wsdlLocation());
    } catch (java.net.MalformedURLException mue) {
      mue.printStackTrace();
    }
  }
  return url;
}

代码示例来源:origin: apache/cxf

public String getWsdlLocation() {
  for (WebService service : wsAnnotations) {
    if (!StringUtils.isEmpty(service.wsdlLocation())) {
      return service.wsdlLocation();
    }
  }
  if (null != wsProviderAnnotation
    && !StringUtils.isEmpty(wsProviderAnnotation.wsdlLocation())) {
    return wsProviderAnnotation.wsdlLocation();
  }
  return null;
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

private static String getWsdlLocation(Class<?> clazz) {
  WebService webService = clazz.getAnnotation(WebService.class);
  if (webService != null) {
    String wsdlLocation = webService.wsdlLocation().trim();
    if (wsdlLocation.length() == 0) wsdlLocation = null;
    return wsdlLocation;
  }
  WebServiceClient webServiceClient = clazz.getAnnotation(WebServiceClient.class);
  if (webServiceClient != null) {
    String wsdlLocation = webServiceClient.wsdlLocation().trim();
    if (wsdlLocation.length() == 0) wsdlLocation = null;
    return wsdlLocation;
  }
  WebServiceProvider webServiceProvider = clazz.getAnnotation(WebServiceProvider.class);
  if (webServiceProvider != null) {
    String wsdlLocation = webServiceProvider.wsdlLocation().trim();
    if (wsdlLocation.length() == 0) wsdlLocation = null;
    return wsdlLocation;
  }
  return null;
}

代码示例来源:origin: org.ow2.jonas/jonas-webservices-jaxws-core

/**
 * @param klass class supporting annotations
 * @return the 'wsdlLocation' attribute's value (from @WebService or @WebServiceProvider)
 */
public static String getWsdlLocation(Class<?> klass) {
  WebService ws = getWebService(klass);
  if (ws != null) {
    return ws.wsdlLocation();
  }
  WebServiceProvider wsp = getWebServiceProvider(klass);
  if (wsp != null) {
    return wsp.wsdlLocation();
  }
  throw new IllegalStateException("Class '" + klass + "' have neither @WebService nor @WebServiceProvider annotation");
}

代码示例来源:origin: javaee/metro-jax-ws

private WSDLService getWSDLModelfromSEI(final Class sei) {
  WebService ws = AccessController.doPrivileged(new PrivilegedAction<WebService>() {
    public WebService run() {
      return (WebService) sei.getAnnotation(WebService.class);
    }
  });
  if (ws == null || ws.wsdlLocation().equals(""))
    return null;
  String wsdlLocation = ws.wsdlLocation();
  wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
  Source wsdl = new StreamSource(wsdlLocation);
  WSDLService service = null;
  try {
    URL url = wsdl.getSystemId() == null ? null : new URL(wsdl.getSystemId());
    WSDLModel model = parseWSDL(url, wsdl, sei);
    service = model.getService(this.serviceName);
    if (service == null)
      throw new WebServiceException(
          ClientMessages.INVALID_SERVICE_NAME(this.serviceName,
              buildNameList(model.getServices().keySet())));
  } catch (MalformedURLException e) {
    throw new WebServiceException(ClientMessages.INVALID_WSDL_URL(wsdl.getSystemId()));
  }
  return service;
}

代码示例来源:origin: com.sun.xml.ws/rt

private WSDLService getWSDLModelfromSEI(final Class sei) {
  WebService ws = AccessController.doPrivileged(new PrivilegedAction<WebService>() {
    public WebService run() {
      return (WebService) sei.getAnnotation(WebService.class);
    }
  });
  if (ws == null || ws.wsdlLocation().equals(""))
    return null;
  String wsdlLocation = ws.wsdlLocation();
  wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
  Source wsdl = new StreamSource(wsdlLocation);
  WSDLService service = null;
  try {
    URL url = wsdl.getSystemId() == null ? null : new URL(wsdl.getSystemId());
    WSDLModel model = parseWSDL(url, wsdl, sei);
    service = model.getService(this.serviceName);
    if (service == null)
      throw new WebServiceException(
          ClientMessages.INVALID_SERVICE_NAME(this.serviceName,
              buildNameList(model.getServices().keySet())));
  } catch (MalformedURLException e) {
    throw new WebServiceException(ClientMessages.INVALID_WSDL_URL(wsdl.getSystemId()));
  }
  return service;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

private WSDLService getWSDLModelfromSEI(final Class sei) {
  WebService ws = AccessController.doPrivileged(new PrivilegedAction<WebService>() {
    public WebService run() {
      return (WebService) sei.getAnnotation(WebService.class);
    }
  });
  if (ws == null || ws.wsdlLocation().equals(""))
    return null;
  String wsdlLocation = ws.wsdlLocation();
  wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
  Source wsdl = new StreamSource(wsdlLocation);
  WSDLService service = null;
  try {
    URL url = wsdl.getSystemId() == null ? null : new URL(wsdl.getSystemId());
    WSDLModel model = parseWSDL(url, wsdl, sei);
    service = model.getService(this.serviceName);
    if (service == null)
      throw new WebServiceException(
          ClientMessages.INVALID_SERVICE_NAME(this.serviceName,
              buildNameList(model.getServices().keySet())));
  } catch (MalformedURLException e) {
    throw new WebServiceException(ClientMessages.INVALID_WSDL_URL(wsdl.getSystemId()));
  }
  return service;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

/**
 * Returns the wsdl from @WebService, or @WebServiceProvider annotation using
 * wsdlLocation element.
 *
 * @param implType
 *      endpoint implementation class
 *      make sure that you called {@link #verifyImplementorClass} on it.
 * @return wsdl if there is wsdlLocation, else null
 */
public static @Nullable String getWsdlLocation(Class<?> implType, MetadataReader metadataReader) {
  if (metadataReader == null) {
    metadataReader = new ReflectAnnotationReader();
  }
  WebService ws = metadataReader.getAnnotation(WebService.class, implType);
  if (ws != null) {
    return nullIfEmpty(ws.wsdlLocation());
  } else {
    WebServiceProvider wsProvider = implType.getAnnotation(WebServiceProvider.class);
    assert wsProvider != null;
    return nullIfEmpty(wsProvider.wsdlLocation());
  }
}

代码示例来源:origin: javaee/metro-jax-ws

/**
 * Returns the wsdl from @WebService, or @WebServiceProvider annotation using
 * wsdlLocation element.
 *
 * @param implType
 *      endpoint implementation class
 *      make sure that you called {@link #verifyImplementorClass} on it.
 * @return wsdl if there is wsdlLocation, else null
 */
public static @Nullable String getWsdlLocation(Class<?> implType, MetadataReader metadataReader) {
  if (metadataReader == null) {
    metadataReader = new ReflectAnnotationReader();
  }
  WebService ws = metadataReader.getAnnotation(WebService.class, implType);
  if (ws != null) {
    return nullIfEmpty(ws.wsdlLocation());
  } else {
    WebServiceProvider wsProvider = implType.getAnnotation(WebServiceProvider.class);
    assert wsProvider != null;
    return nullIfEmpty(wsProvider.wsdlLocation());
  }
}

代码示例来源:origin: com.sun.xml.ws/rt

/**
 * Returns the wsdl from @WebService, or @WebServiceProvider annotation using
 * wsdlLocation element.
 *
 * @param implType
 *      endpoint implementation class
 *      make sure that you called {@link #verifyImplementorClass} on it.
 * @return wsdl if there is wsdlLocation, else null
 */
public static @Nullable String getWsdlLocation(Class<?> implType, MetadataReader metadataReader) {
  if (metadataReader == null) {
    metadataReader = new ReflectAnnotationReader();
  }
  WebService ws = metadataReader.getAnnotation(WebService.class, implType);
  if (ws != null) {
    return nullIfEmpty(ws.wsdlLocation());
  } else {
    WebServiceProvider wsProvider = implType.getAnnotation(WebServiceProvider.class);
    assert wsProvider != null;
    return nullIfEmpty(wsProvider.wsdlLocation());
  }
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

public static WebServiceAnnot createFromAnnotation(Annotation annotation) {
  WebServiceAnnot returnAnnot = null;
  if (annotation != null && annotation instanceof javax.jws.WebService) {
    javax.jws.WebService ws = (javax.jws.WebService) annotation;
    return new WebServiceAnnot(ws.name(),
                  ws.targetNamespace(),
                  ws.serviceName(),
                  ws.wsdlLocation(),
                  ws.endpointInterface(),
                  ws.portName());
                 
  }
  return returnAnnot;
}

代码示例来源:origin: apache/axis2-java

public static WebServiceAnnot createFromAnnotation(Annotation annotation) {
  WebServiceAnnot returnAnnot = null;
  if (annotation != null && annotation instanceof javax.jws.WebService) {
    javax.jws.WebService ws = (javax.jws.WebService) annotation;
    return new WebServiceAnnot(ws.name(),
                  ws.targetNamespace(),
                  ws.serviceName(),
                  ws.wsdlLocation(),
                  ws.endpointInterface(),
                  ws.portName());
                 
  }
  return returnAnnot;
}

代码示例来源:origin: org.codehaus.xfire/xfire-java5

public WebServiceAnnotation getWebServiceAnnotation(Class clazz)
{
  WebService webService = (WebService) clazz.getAnnotation(WebService.class);
  if (webService != null)
  {
    WebServiceAnnotation annotation = new WebServiceAnnotation();
    annotation.setEndpointInterface(webService.endpointInterface());
    annotation.setName(webService.name());
    annotation.setServiceName(webService.serviceName());
    annotation.setTargetNamespace(webService.targetNamespace());
    annotation.setPortName(webService.portName());
    annotation.setWsdlLocation(webService.wsdlLocation());
    
    return annotation;
  }
  else
  {
    return null;
  }
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

public String getAnnoWebServiceWSDLLocation() {
  if (annotation_WsdlLocation == null) {
    if (getAnnoWebService() != null) {
      annotation_WsdlLocation = getAnnoWebService().wsdlLocation();
      //If this is not an implicit SEI, then make sure that its not on the SEI
      if (composite.isServiceProvider()) {
        if (!DescriptionUtils.isEmpty(getAnnoWebServiceEndpointInterface())) {
          DescriptionBuilderComposite seic =
              getServiceDescriptionImpl().getDBCMap()
                  .get(composite.getWebServiceAnnot().endpointInterface());
          if (!DescriptionUtils.isEmpty(seic.getWebServiceAnnot().wsdlLocation())) {
            annotation_WsdlLocation = seic.getWebServiceAnnot().wsdlLocation();
          }
        }
      }
    } else if (getAnnoWebServiceProvider() != null
        && !DescriptionUtils.isEmpty(getAnnoWebServiceProvider().wsdlLocation())) {
      annotation_WsdlLocation = getAnnoWebServiceProvider().wsdlLocation();
    } else {
      // There is no default value per JSR-181 MR Sec 4.1 pg 16
      annotation_WsdlLocation = "";
    }
  }
  return annotation_WsdlLocation;
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

/**
 * 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);
  }
}

代码示例来源:origin: apache/axis2-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);
  }
}

相关文章