javax.xml.ws.WebFault.targetNamespace()方法的使用及代码示例

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

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

WebFault.targetNamespace介绍

暂无

代码示例

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

@Override
public QName getFaultName(InterfaceInfo service, OperationInfo o, Class<?> exClass, Class<?> beanClass) {
  WebFault fault = exClass.getAnnotation(WebFault.class);
  if (fault != null) {
    String name = fault.name();
    if (name.length() == 0) {
      name = exClass.getSimpleName();
    }
    String ns = fault.targetNamespace();
    if (ns.length() == 0) {
      ns = service.getName().getNamespaceURI();
    }
    return new QName(ns, name);
  }
  return null;
}

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

private QName getFaultName(WebFault wf, Class<?> cls, OperationInfo op) {
  String ns = wf.targetNamespace();
  if (StringUtils.isEmpty(ns)) {
    ns = op.getName().getNamespaceURI();
  }
  String name = wf.name();
  if (StringUtils.isEmpty(name)) {
    name = cls.getSimpleName();
  }
  return new QName(ns, name);
}

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

private QName getFaultName(Exception webFault) {
  QName faultName = null;
  WebFault wf = webFault.getClass().getAnnotation(WebFault.class);
  if (wf != null) {
    faultName = new QName(wf.targetNamespace(), wf.name());
  }
  return faultName;
}

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

public String getTargetNamespace() {
  if (targetNamespace.length() > 0) {
    return targetNamespace;
  } else {
    // Load the annotation. The annotation may not be present in WSGen cases
    WebFault annotation = this.getAnnoWebFault();
    if (annotation != null &&
        annotation.targetNamespace().length() > 0) {
      targetNamespace = annotation.targetNamespace();
    } else {
      // The default is undefined
      // The JAX-WS layer may use the fault bean information to determine the name
    }
  }
  return targetNamespace;
}

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

public String getTargetNamespace() {
  if (targetNamespace.length() > 0) {
    return targetNamespace;
  } else {
    // Load the annotation. The annotation may not be present in WSGen cases
    WebFault annotation = this.getAnnoWebFault();
    if (annotation != null &&
        annotation.targetNamespace().length() > 0) {
      targetNamespace = annotation.targetNamespace();
    } else {
      // The default is undefined
      // The JAX-WS layer may use the fault bean information to determine the name
    }
  }
  return targetNamespace;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-bindings-coloc

private QName getFaultName(Exception webFault) {
  QName faultName = null;
  WebFault wf = webFault.getClass().getAnnotation(WebFault.class);
  if (wf != null) {
    faultName = new QName(wf.targetNamespace(), wf.name());
  }
  return faultName;
}

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

public Class<?> getWebFault(QName faultName) {
  for (Class<?> clazz : getMethod().getExceptionTypes()) {
    WebFault wfAnnotation = clazz.getAnnotation(WebFault.class);
    if (wfAnnotation != null
      && (wfAnnotation.name().equals(faultName.getLocalPart()) 
      && wfAnnotation.targetNamespace().equals(faultName.getNamespaceURI()))) {
      return clazz;
    }
  }
  return null;
}

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

public void write(Object obj, T output) {
  WebFault wfAnnotation = obj.getClass().getAnnotation(WebFault.class);
  if (wfAnnotation != null) {
    QName elName = new QName(wfAnnotation.targetNamespace(), wfAnnotation.name());
    write(obj, elName, output);
  }
}
public void write(Object obj, QName elName, T output) {

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

public void write(Object obj, T output) {
  WebFault wfAnnotation = obj.getClass().getAnnotation(WebFault.class);
  if (wfAnnotation != null) {
    QName elName = new QName(wfAnnotation.targetNamespace(), wfAnnotation.name());
    write(obj, elName, output);
  }
}
public void write(Object obj, QName elName, T output) {

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

@Override
public QName getFaultName(InterfaceInfo service, OperationInfo o, Class<?> exClass, Class<?> beanClass) {
  WebFault fault = exClass.getAnnotation(WebFault.class);
  if (fault != null) {
    String name = fault.name();
    if (name.length() == 0) {
      name = exClass.getSimpleName();
    }
    String ns = fault.targetNamespace();
    if (ns.length() == 0) {
      ns = service.getName().getNamespaceURI();
    }
    return new QName(ns, name);
  }
  return null;
}

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

private static boolean matchFault(Throwable t, FaultInfo fi) {
  //REVISIT not sure if this class-based comparison works in general as the fault class defined
  // in the service interface has no direct relationship to the message body's type.
  MessagePartInfo fmpi = fi.getFirstMessagePart();
  Class<?> fiTypeClass = fmpi.getTypeClass();
  if (fiTypeClass != null && t.getClass().isAssignableFrom(fiTypeClass)) {
    return true;
  }
  // CXF-6575
  QName fiName = fmpi.getConcreteName();
  WebFault wf = t.getClass().getAnnotation(WebFault.class);
  return wf != null  && fiName != null
    && wf.targetNamespace() != null && wf.targetNamespace().equals(fiName.getNamespaceURI())
    && wf.name() != null && wf.name().equals(fiName.getLocalPart());
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-addr

private static boolean matchFault(Throwable t, FaultInfo fi) {
  //REVISIT not sure if this class-based comparison works in general as the fault class defined
  // in the service interface has no direct relationship to the message body's type.
  MessagePartInfo fmpi = fi.getFirstMessagePart();
  Class<?> fiTypeClass = fmpi.getTypeClass();
  if (fiTypeClass != null && t.getClass().isAssignableFrom(fiTypeClass)) {
    return true;
  }
  // CXF-6575
  QName fiName = fmpi.getConcreteName();
  WebFault wf = t.getClass().getAnnotation(WebFault.class);
  return wf != null  && fiName != null
    && wf.targetNamespace() != null && wf.targetNamespace().equals(fiName.getNamespaceURI())
    && wf.name() != null && wf.name().equals(fiName.getLocalPart());
}

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

private QName getFaultName(WebFault wf, Class<?> cls, OperationInfo op) {
  String ns = wf.targetNamespace();
  if (StringUtils.isEmpty(ns)) {
    ns = op.getName().getNamespaceURI();
  }
  String name = wf.name();
  if (StringUtils.isEmpty(name)) {
    name = cls.getSimpleName();
  }
  return new QName(ns, name);
}

代码示例来源:origin: stoicflame/enunciate

/**
 * Gets the target namespace of the implicit fault bean, or null if this web fault defines
 * an explicit fault info bean.
 *
 * @return the target namespace of the implicit fault bean, or null.
 */
public String getTargetNamespace() {
 String targetNamespace = null;
 if (isImplicitSchemaElement()) {
  if (annotation != null) {
   targetNamespace = annotation.targetNamespace();
  }
  if ((targetNamespace == null) || ("".equals(targetNamespace))) {
   targetNamespace = calculateNamespaceURI();
  }
 }
 return targetNamespace;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Gets the target namespace of the implicit fault bean, or null if this web fault defines
 * an explicit fault info bean.
 *
 * @return the target namespace of the implicit fault bean, or null.
 */
public String getTargetNamespace() {
 String targetNamespace = null;
 if (isImplicitSchemaElement()) {
  if (annotation != null) {
   targetNamespace = annotation.targetNamespace();
  }
  if ((targetNamespace == null) || ("".equals(targetNamespace))) {
   targetNamespace = calculateNamespaceURI();
  }
 }
 return targetNamespace;
}

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

@SuppressWarnings("unchecked")
@Override
protected QName getFaultName(Service service, OperationInfo o, Class exClass, Class beanClass)
{
  WebFault webFault = (WebFault) exClass.getAnnotation(WebFault.class);
  
  if (webFault == null || webFault.name().equals(""))
    return super.getFaultName(service, o, exClass, beanClass);
  String ns = webFault.targetNamespace();
  if (ns == null) ns = service.getTargetNamespace();
  
  return new QName(ns, webFault.name());
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Gets the target namespace of the implicit fault bean, or null if this web fault defines
 * an explicit fault info bean.
 *
 * @return the target namespace of the implicit fault bean, or null.
 */
public String getTargetNamespace() {
 String targetNamespace = null;
 if (isImplicitSchemaElement()) {
  if (annotation != null) {
   targetNamespace = annotation.targetNamespace();
  }
  if ((targetNamespace == null) || ("".equals(targetNamespace))) {
   targetNamespace = calculateNamespaceURI();
  }
 }
 return targetNamespace;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public static QName getElementName(Class<? extends Throwable> exceptionClass, Operation operation) {
  WebFault webFault = exceptionClass.getAnnotation(WebFault.class);
  
  // TUSCANY-3283 - all generated classes (including exception) should go in the namespace
  //                of the interface not the namespace of the originating exception. 
  //                consequently we need to create a matching package name for the schema
  String namespace = null;
  if (operation != null && operation.getInterface() instanceof JavaInterface){
    namespace = ((JavaInterface)operation.getInterface()).getQName().getNamespaceURI();
  }
  
  String name = null;
  if (webFault != null) {
    namespace = webFault.targetNamespace();
    name = webFault.name();
  }
  if (namespace == null) {
    namespace = JavaInterfaceUtil.getNamespace(exceptionClass);
  }
  if (name == null) {
    name = exceptionClass.getSimpleName();
  }
  return new QName(namespace, name);
}

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

/**
 * This method will be used to attach @WebFault annotation data to the
 * <code>DescriptionBuilderComposite</code>
 *
 * @param composite - <code>DescriptionBuilderComposite</code>
 */
private void attachWebFaultAnnotation(DescriptionBuilderComposite composite) {
  WebFault webFault = (WebFault)ConverterUtils.getAnnotation(
      WebFault.class, serviceClass);
  if (webFault != null) {
    WebFaultAnnot webFaultAnnot = WebFaultAnnot.createWebFaultAnnotImpl();
    webFaultAnnot.setFaultBean(webFault.faultBean());
    webFaultAnnot.setName(webFault.name());
    webFaultAnnot.setTargetNamespace(webFault.targetNamespace());
    try {
      webFaultAnnot.setMessageName(webFault.messageName());
    } catch (NoSuchMethodError ex) {
      // Ignore: we are running on Java 1.6 and the JAX-WS 2.2 libs have not been endorsed
    }
    composite.setWebFaultAnnot(webFaultAnnot);
  }
}

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

/**
 * This method will be used to attach @WebFault annotation data to the
 * <code>DescriptionBuilderComposite</code>
 *
 * @param composite - <code>DescriptionBuilderComposite</code>
 */
private void attachWebFaultAnnotation(DescriptionBuilderComposite composite) {
  WebFault webFault = (WebFault)ConverterUtils.getAnnotation(
      WebFault.class, serviceClass);
  if (webFault != null) {
    WebFaultAnnot webFaultAnnot = WebFaultAnnot.createWebFaultAnnotImpl();
    webFaultAnnot.setFaultBean(webFault.faultBean());
    webFaultAnnot.setName(webFault.name());
    webFaultAnnot.setTargetNamespace(webFault.targetNamespace());
    try {
      webFaultAnnot.setMessageName(webFault.messageName());
    } catch (NoSuchMethodError ex) {
      // Ignore: we are running on Java 1.6 and the JAX-WS 2.2 libs have not been endorsed
    }
    composite.setWebFaultAnnot(webFaultAnnot);
  }
}

相关文章

微信公众号

最新文章

更多