javax.xml.ws.WebFault类的使用及代码示例

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

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

WebFault介绍

暂无

代码示例

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

/**
 * @author Juergen Hoeller
 */
@WebFault
@SuppressWarnings("serial")
public class OrderNotFoundException extends Exception {

  private String faultInfo;

  public OrderNotFoundException(String message) {
    super(message);
  }

  public OrderNotFoundException(String message, String faultInfo) {
    super(message);
    this.faultInfo = faultInfo;
  }

  public String getFaultInfo() {
    return this.faultInfo;
  }

}

代码示例来源: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 Object createFaultInfoBean(WebFault fault, Throwable cause) {
  if (!StringUtils.isEmpty(fault.faultBean())) {
    try {
      Class<?> cls = ClassLoaderUtils.loadClass(fault.faultBean(),
                           cause.getClass());
      if (cls != null) {

代码示例来源: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: OpenWiseSolutions/openhub-framework

/**
 * Gets the SOAP fault name from the class with {@link WebFault @WebFault}.
 *
 * @param clazz the class that represents fault
 * @return fault name
 */
protected static String getExFaultName(Class clazz) {
  WebFault annotation = AnnotationUtils.findAnnotation(clazz, WebFault.class);
  return annotation.name();
}

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

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

private String getParticleName() {
 String name;
 name = getSimpleName().toString();
 if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) {
  name = annotation.name();
 }
 return name;
}

代码示例来源: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: citerus/dddsample-core

@WebFault(name = "HandlingReportErrors", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/")
public class HandlingReportErrors_Exception
  extends Exception

代码示例来源: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: org.codehaus.enunciate/enunciate-core

/**
 * The element name of the implicit web fault bean, or null if this isn't an implicit web fault.
 *
 * @return The element name of the implicit web fault, or null.
 */
public String getElementName() {
 String name = null;
 if (isImplicitSchemaElement()) {
  name = getSimpleName();
  if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) {
   name = annotation.name();
  }
 }
 return name;
}

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

@Override
protected Class<?> getBeanClass(Class<?> exClass) {
  try {
    if (java.rmi.ServerException.class.isAssignableFrom(exClass)
      || java.rmi.RemoteException.class.isAssignableFrom(exClass)
      || "javax.xml.ws".equals(PackageUtils.getPackageName(exClass))) {
      return null;
    }
    Method getFaultInfo = exClass.getMethod("getFaultInfo", new Class[0]);
    return getFaultInfo.getReturnType();
  } catch (SecurityException e) {
    throw new ServiceConstructionException(e);
  } catch (NoSuchMethodException e) {
    //ignore for now
  }
  WebFault fault = exClass.getAnnotation(WebFault.class);
  if (fault != null && !StringUtils.isEmpty(fault.faultBean())) {
    try {
      return ClassLoaderUtils.loadClass(fault.faultBean(),
                        exClass);
    } catch (ClassNotFoundException e1) {
      //ignore
    }
  }
  return super.getBeanClass(exClass);
}

代码示例来源: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: opensourceBIM/BIMserver

@WebFault(faultBean = "ServerException", name = "ServerException", targetNamespace="bimserver")
public class ServerException extends ServiceException {
  private static final long serialVersionUID = -8757136271196139727L;

  public ServerException(String userMessage) {
    super(userMessage);
  }
  
  public ServerException(String message, ErrorCode errorCode) {
    super(message, errorCode);
  }

  public ServerException(String userMessage, Throwable e) {
    super(userMessage, e);
  }

  public ServerException(Throwable e) {
    super(e);
  }
}

代码示例来源: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: org.apache.axis2/axis2-metadata

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

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

private String getWebFaultBean(final Class<?> exceptionClass) {
  WebFault fault = exceptionClass.getAnnotation(WebFault.class);
  if (fault == null) {
    return null;
  }
  return fault.faultBean();
}

代码示例来源: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: Libresonic/libresonic

@WebFault(name = "customFaultDetail", targetNamespace = "http://www.sonos.com/Services/1.1")
public class CustomFault extends Exception {

相关文章

微信公众号

最新文章

更多