public Object getPayload(JAXBContext arg0) { try { Source s = getPayload(); if (s instanceof DOMSource) { DOMSource ds = (DOMSource)s; ds.setNode(org.apache.cxf.helpers.DOMUtils.getDomElement(ds.getNode())); Node parent = ds.getNode().getParentNode(); Node next = ds.getNode().getNextSibling(); if (parent instanceof DocumentFragment) { parent.removeChild(ds.getNode()); } try { return JAXBUtils.unmarshall(arg0, ds); } finally { if (parent instanceof DocumentFragment) { parent.insertBefore(ds.getNode(), next); } } } return JAXBUtils.unmarshall(arg0, getPayload()); } catch (JAXBException e) { throw new WebServiceException(e); } }
private void validateFaultDetail(Element detail, Schema schema, BindingOperationInfo bop) throws Exception { if (detail != null) { Element el = DOMUtils.getFirstElement(detail); while (el != null) { QName qn = DOMUtils.getElementQName(el); for (BindingFaultInfo bfi : bop.getFaults()) { if (bfi.getFaultInfo().getMessagePartByIndex(0).getConcreteName().equals(qn)) { //Found a fault with the correct QName, we can validate it schema.newValidator().validate(new DOMSource(DOMUtils.getDomElement(el))); } } el = DOMUtils.getNextElement(el); } } } private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) {
protected Element createElementNS(String ns, String pfx, String local) { if (pfx != null) { local = pfx + ":" + local; } Element element = document.createElementNS(ns, local); element = (Element)DOMUtils.getDomElement(element); return element; }
protected Element createElementNS(String ns, String pfx, String local) { if (pfx != null) { local = pfx + ":" + local; } Element element = document.createElementNS(ns, local); element = (Element)DOMUtils.getDomElement(element); return element; }
public void writeComment(String value) throws XMLStreamException { Node nd = document.createComment(value); nd = DOMUtils.getDomElement(nd); if (currentNode == null) { document.appendChild(nd); } else { currentNode.appendChild(nd); } }
public void writeCData(String data) throws XMLStreamException { currentNode.appendChild(DOMUtils.getDomElement(document.createCDATASection(data))); }
public void writeCharacters(String text) throws XMLStreamException { Node nd = document.createTextNode(text); nd = DOMUtils.getDomElement(nd); if (currentNode != null) { currentNode.appendChild(nd); } else { document.appendChild(nd); } }
public void writeComment(String value) throws XMLStreamException { Node nd = document.createComment(value); nd = DOMUtils.getDomElement(nd); if (currentNode == null) { document.appendChild(nd); } else { currentNode.appendChild(nd); } }
public void writeCharacters(String text) throws XMLStreamException { Node nd = document.createTextNode(text); nd = DOMUtils.getDomElement(nd); if (currentNode != null) { currentNode.appendChild(nd); } else { document.appendChild(nd); } }
public void writeCData(String data) throws XMLStreamException { currentNode.appendChild(DOMUtils.getDomElement(document.createCDATASection(data))); }
/** * Get the SOAP Body */ @Override public Element getSOAPBody() { soapBody = (Element)DOMUtils.getDomElement(soapBody); if (soapBody != null) { return soapBody; } return WSSecurityUtil.findBodyElement(doc); } }
/** * Get the SOAP Body */ @Override public Element getSOAPBody() { soapBody = (Element)DOMUtils.getDomElement(soapBody); if (soapBody != null) { return soapBody; } return WSSecurityUtil.findBodyElement(doc); } }
public static boolean doesConformToFilter(Element elm, FilterType filter) { if ((filter == null) || (filter.getContent() == null)) { return true; } String xPathString = (String)filter.getContent().get(0); try { XPath xPath = xPathFactory.newXPath(); XPathExpression xPathExpression = xPath.compile(xPathString); elm = (Element)DOMUtils.getDomElement(elm); return (Boolean)xPathExpression.evaluate(elm, XPathConstants.BOOLEAN); } catch (XPathExpressionException ex) { LOG.severe(ex.toString()); return false; } }
public static boolean doesConformToFilter(Element elm, FilterType filter) { if ((filter == null) || (filter.getContent() == null)) { return true; } String xPathString = (String)filter.getContent().get(0); try { XPath xPath = xPathFactory.newXPath(); XPathExpression xPathExpression = xPath.compile(xPathString); elm = (Element)DOMUtils.getDomElement(elm); return (Boolean)xPathExpression.evaluate(elm, XPathConstants.BOOLEAN); } catch (XPathExpressionException ex) { LOG.severe(ex.toString()); return false; } }
nd = DOMUtils.getDomElement(nd); frag.appendChild(nd); nd = SAAJUtils.getBody(soapMessage).getFirstChild();
protected void insertAfter(Element child, Element sib) { child = (Element)DOMUtils.getDomElement(child); if (sib.getNextSibling() == null) { secHeader.getSecurityHeaderElement().appendChild(child); } else { secHeader.getSecurityHeaderElement().insertBefore(child, sib.getNextSibling()); } }
protected void insertAfter(Element child, Element sib) { child = (Element)DOMUtils.getDomElement(child); if (sib.getNextSibling() == null) { secHeader.getSecurityHeaderElement().appendChild(child); } else { secHeader.getSecurityHeaderElement().insertBefore(child, sib.getNextSibling()); } }
private void validateFaultDetail(Element detail, Schema schema, BindingOperationInfo bop) throws Exception { if (detail != null) { Element el = DOMUtils.getFirstElement(detail); while (el != null) { QName qn = DOMUtils.getElementQName(el); for (BindingFaultInfo bfi : bop.getFaults()) { if (bfi.getFaultInfo().getMessagePartByIndex(0).getConcreteName().equals(qn)) { //Found a fault with the correct QName, we can validate it schema.newValidator().validate(new DOMSource(DOMUtils.getDomElement(el))); } } el = DOMUtils.getNextElement(el); } } } private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) {
protected void addSupportingElement(Element el) { el = (Element)DOMUtils.getDomElement(el); if (lastSupportingTokenElement != null) { insertAfter(el, lastSupportingTokenElement); } else if (lastDerivedKeyElement != null) { insertAfter(el, lastDerivedKeyElement); } else if (lastEncryptedKeyElement != null) { insertAfter(el, lastEncryptedKeyElement); } else if (topDownElement != null) { insertAfter(el, topDownElement); } else if (bottomUpElement != null) { secHeader.getSecurityHeaderElement().insertBefore(el, bottomUpElement); } else { secHeader.getSecurityHeaderElement().appendChild(el); } lastSupportingTokenElement = el; }
protected void addSupportingElement(Element el) { el = (Element)DOMUtils.getDomElement(el); if (lastSupportingTokenElement != null) { insertAfter(el, lastSupportingTokenElement); } else if (lastDerivedKeyElement != null) { insertAfter(el, lastDerivedKeyElement); } else if (lastEncryptedKeyElement != null) { insertAfter(el, lastEncryptedKeyElement); } else if (topDownElement != null) { insertAfter(el, topDownElement); } else if (bottomUpElement != null) { secHeader.getSecurityHeaderElement().insertBefore(el, bottomUpElement); } else { secHeader.getSecurityHeaderElement().appendChild(el); } lastSupportingTokenElement = el; }