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