private void assignProperties(Object e, StartElement element) wrapper.registerCustomEditor(QName.class, new QNameEditor());
private void assignProperties(Object e, StartElement element) wrapper.registerCustomEditor(QName.class, new QNameEditor());
@Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasLength(text)) { setValue(null); } else { String[] tokens = StringUtils.commaDelimitedListToStringArray(text); if (tokens.length < FAULT_STRING_INDEX) { throw new IllegalArgumentException("Invalid amount of comma delimited values in [" + text + "]: SoapFaultDefinitionEditor requires at least 1"); } SoapFaultDefinition definition = new SoapFaultDefinition(); QNameEditor qNameEditor = new QNameEditor(); qNameEditor.setAsText(tokens[FAULT_CODE_INDEX].trim()); definition.setFaultCode((QName) qNameEditor.getValue()); if (tokens.length > 1) { definition.setFaultStringOrReason(tokens[FAULT_STRING_INDEX].trim()); if (tokens.length > 2) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(tokens[FAULT_STRING_LOCALE_INDEX].trim()); definition.setLocale((Locale) localeEditor.getValue()); } } setValue(definition); } }
@Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasLength(text)) { setValue(null); } else { String[] tokens = StringUtils.commaDelimitedListToStringArray(text); if (tokens.length < FAULT_STRING_INDEX) { throw new IllegalArgumentException("Invalid amount of comma delimited values in [" + text + "]: SoapFaultDefinitionEditor requires at least 1"); } SoapFaultDefinition definition = new SoapFaultDefinition(); QNameEditor qNameEditor = new QNameEditor(); qNameEditor.setAsText(tokens[FAULT_CODE_INDEX].trim()); definition.setFaultCode((QName) qNameEditor.getValue()); if (tokens.length > 1) { definition.setFaultStringOrReason(tokens[FAULT_STRING_INDEX].trim()); if (tokens.length > 2) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(tokens[FAULT_STRING_LOCALE_INDEX].trim()); definition.setLocale((Locale) localeEditor.getValue()); } } setValue(definition); } }
@Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasLength(text)) { setValue(null); } else { String[] tokens = StringUtils.commaDelimitedListToStringArray(text); if (tokens.length < FAULT_STRING_INDEX) { throw new IllegalArgumentException("Invalid amount of comma delimited values in [" + text + "]: SoapFaultDefinitionEditor requires at least 1"); } SoapFaultDefinition definition = new SoapFaultDefinition(); QNameEditor qNameEditor = new QNameEditor(); qNameEditor.setAsText(tokens[FAULT_CODE_INDEX].trim()); definition.setFaultCode((QName) qNameEditor.getValue()); if (tokens.length > 1) { definition.setFaultStringOrReason(tokens[FAULT_STRING_INDEX].trim()); if (tokens.length > 2) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(tokens[FAULT_STRING_LOCALE_INDEX].trim()); definition.setLocale((Locale) localeEditor.getValue()); } } setValue(definition); } }
@Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasLength(text)) { setValue(null); } else { String[] tokens = StringUtils.commaDelimitedListToStringArray(text); if (tokens.length < FAULT_STRING_INDEX) { throw new IllegalArgumentException("Invalid amount of comma delimited values in [" + text + "]: SoapFaultDefinitionEditor requires at least 1"); } SoapFaultDefinition definition = new SoapFaultDefinition(); QNameEditor qNameEditor = new QNameEditor(); qNameEditor.setAsText(tokens[FAULT_CODE_INDEX].trim()); definition.setFaultCode((QName) qNameEditor.getValue()); if (tokens.length > 1) { definition.setFaultStringOrReason(tokens[FAULT_STRING_INDEX].trim()); if (tokens.length > 2) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(tokens[FAULT_STRING_LOCALE_INDEX].trim()); definition.setLocale((Locale) localeEditor.getValue()); } } setValue(definition); } }
/** * Builder method from Spring WS SOAP fault object. * @param fault * @return */ public static SoapFault from(org.springframework.ws.soap.SoapFault fault) { QNameEditor qNameEditor = new QNameEditor(); qNameEditor.setValue(fault.getFaultCode()); SoapFault soapFault = new SoapFault() .faultCode(qNameEditor.getAsText()) .faultActor(fault.getFaultActorOrRole()) .faultString(fault.getFaultStringOrReason()); if (fault.getFaultDetail() != null) { Iterator<SoapFaultDetailElement> details = fault.getFaultDetail().getDetailEntries(); while (details.hasNext()) { SoapFaultDetailElement soapFaultDetailElement = details.next(); soapFault.addFaultDetail(extractFaultDetail(soapFaultDetailElement)); } } return soapFault; }