public Iterator getFaultReasonTexts() throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "NOT_SUPPORT_REASON")); if (faultstring == null) { findReasonElement(); if (faultstring == null) return Collections.EMPTY_LIST.iterator(); } ArrayList<String> texts = new ArrayList<String>(); Iterator it = faultstring.getChildElements(Constants.SOAP12_TEXT); while (it.hasNext()) { SOAPElement textElement = (SOAPElement)it.next(); texts.add(textElement.getValue()); } if (texts.isEmpty()) throw new SOAPException(BundleUtils.getMessage(bundle, "NO_TEXT_ELEMENTS_FOUND")); return texts.iterator(); }
public String getFaultReasonText(Locale locale) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "NOT_SUPPORT_REASON")); if (locale == null) return null; if (faultstring == null) { findReasonElement(); if (faultstring == null) return null; } SOAPElement textElement = getTextElement(locale); return textElement != null ? textElement.getValue() : null; }
public Iterator getFaultReasonLocales() throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "NOT_SUPPORT_REASON")); if (faultstring == null) { findReasonElement(); if (faultstring == null) return Collections.EMPTY_LIST.iterator(); } ArrayList<Locale> locales = new ArrayList<Locale>(); Iterator it = faultstring.getChildElements(Constants.SOAP12_TEXT); while (it.hasNext()) { SOAPElement textElement = (SOAPElement)it.next(); Locale locale = getLocale(textElement); if (locale == null) throw new SOAPException(BundleUtils.getMessage(bundle, "LANG_ATTRIBUTE_NOT_PRESENT")); locales.add(locale); } if (locales.isEmpty()) throw new SOAPException(BundleUtils.getMessage(bundle, "NO_TEXT_ELEMENTS_FOUND")); return locales.iterator(); }
public void addFaultReasonText(String text, Locale locale) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "NOT_SUPPORT_REASON")); if (locale == null) throw new SOAPException(BundleUtils.getMessage(bundle, "LOCALE_IS_NULL")); if (faultstring == null) { findReasonElement(); if (faultstring == null) faultstring = addQualifiedFaultElement("Reason"); } SOAPElement textElement = getTextElement(locale); if (textElement == null) { textElement = faultstring.addChildElement("Text", getPrefix(), getNamespaceURI()); setLocale(textElement, locale); } textElement.setValue(text); }