public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException { if (hasFault()) throw new SOAPException(BundleUtils.getMessage(bundle, "AT_MOST_ONE_SOAPFAULT")); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault.setFaultCode(faultCode); soapFault.setFaultString(faultString, locale); addChildElement(soapFault); return soapFault; }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { if (needsConversionToBodyElement(newChild)) newChild = isFault(newChild) ? convertToSOAPFault(newChild) : convertToBodyElement(newChild); return super.insertBefore(newChild, refChild); }
public boolean hasFault() { return faultIterator().hasNext(); }
private Iterator faultIterator() { return getChildElements(new QName(getNamespaceURI(), "Fault")); }
/** Convert the child into a SOAPBodyElement */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { if (!(child instanceof SOAPBodyElement)) { child = isFault(child) ? convertToSOAPFault(child) : convertToBodyElement(child); } child = super.addChildElement(child); return child; }
if (!checkEquals(soapBody.getPrefix(), domBody.getPrefix())) soapBody.setPrefix(domBody.getPrefix()); attachHRefElements = attachHRefElements || Constants.URI_SOAP11_ENC.equals(soapBody.getAttributeNS(envNS, "encodingStyle")); soapBody.addChildElement(soapFactory.createElement((Element)child, true));
public void processHRefs() throws SOAPException { String bodyStr = DOMWriter.printNode(soapBody, true); boolean debugEnabled = log.isDebugEnabled(); if (debugEnabled) log.debug("Begin processHRefs:\n" + bodyStr); SOAPBodyElement soapBodyElement = soapBody.getBodyElement(); processElement(soapBodyElement); // Process elements after SOAPBodyElement Iterator it = soapBody.getChildElements(); while (it.hasNext()) { Object next = it.next(); if (next instanceof SOAPElement) { // Remove id elements SOAPElement soapElement = (SOAPElement)next; if ((soapElement instanceof SOAPBodyElement) == false) soapBody.removeChild(soapElement); } } bodyStr = DOMWriter.printNode(soapBody, true); if (debugEnabled) log.debug("End processHRefs:\n" + bodyStr); }
public SOAPBodyElement addBodyElement(Name name) throws SOAPException { SOAPBodyElement child = new SOAPBodyElementDoc(name); return (SOAPBodyElement)addChildElement(child); }
@Override public SOAPElement addAttribute(Name name, String value) throws SOAPException { String envNamespace = getNamespaceURI(); if (Constants.NS_SOAP12_ENV.equals(envNamespace) && name.equals(new NameImpl("encodingStyle", Constants.PREFIX_ENV, envNamespace))) throw new SOAPException(BundleUtils.getMessage(bundle, "CANNOT_SET_ENCODINGSTYLE_ON", getElementQName())); return super.addAttribute(name, value); }
public SOAPBodyElement getBodyElement() { SOAPBodyElement bodyElement = null; Iterator it = getChildElements(); while (bodyElement == null && it.hasNext()) { Object next = it.next(); if (next instanceof SOAPBodyElement) bodyElement = (SOAPBodyElement)next; } return bodyElement; }
private boolean isFault(Node node) { return "Fault".equals(node.getLocalName()) && getNamespaceURI().equals(node.getNamespaceURI()); }
public SOAPBody addBody() throws SOAPException { SOAPBody body = getBody(); if (body != null) throw new SOAPException(BundleUtils.getMessage(bundle, "SOAPENVELOPE_ALREADY_HAS_A_BODY_ELEMENT")); body = new SOAPBodyImpl(getPrefix(), getNamespaceURI()); addChildElement(body); return body; }
SOAPBodyElement soapBodyElement = soapBody.getBodyElement(); if (soapBodyElement != null)
public SOAPBodyElement addBodyElement(QName qname) throws SOAPException { SOAPBodyElement child = new SOAPBodyElementDoc(qname); return (SOAPBodyElement)addChildElement(child); }
public Document extractContentAsDocument() throws SOAPException Iterator childElements = getChildElements();
public SOAPFault addFault() throws SOAPException { if (hasFault()) throw new SOAPException(BundleUtils.getMessage(bundle, "AT_MOST_ONE_SOAPFAULT")); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault = (SOAPFaultImpl)addChildElement(soapFault); soapFault.setFaultCode(soapFault.getDefaultFaultCode()); return soapFault; }
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (needsConversionToBodyElement(newChild)) newChild = isFault(newChild) ? convertToSOAPFault(newChild) : convertToBodyElement(newChild); return super.replaceChild(newChild, oldChild); }
public SOAPBodyElement addDocument(Document doc) throws SOAPException { Element rootElement = doc.getDocumentElement(); SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); SOAPElement soapElement = soapFactory.createElement(rootElement); return (SOAPBodyElement)addChildElement(soapElement); }
Iterator it = soapBody.getChildElements(); while (it.hasNext())
public SOAPFault getFault() { Iterator it = faultIterator(); SOAPFault soapFault = it.hasNext() ? (SOAPFault)it.next() : null; return soapFault; }