/** * @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; } }
@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; }
/** * 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); } }
/** * 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(); }
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; }
/** * 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); } }
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; }
@WebFault(name = "HandlingReportErrors", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/") public class HandlingReportErrors_Exception extends Exception
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); }
/** * 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; }
@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); }
/** * 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; }
@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); } }
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; }
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; }
private String getWebFaultBean(final Class<?> exceptionClass) { WebFault fault = exceptionClass.getAnnotation(WebFault.class); if (fault == null) { return null; } return fault.faultBean(); }
/** * 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; }
@WebFault(name = "customFaultDetail", targetNamespace = "http://www.sonos.com/Services/1.1") public class CustomFault extends Exception {