/** * Converts a given Reader to an OMNode. * The reurned OMNode is fully built. * * @param reader * @return * @throws XMLStreamException */ public static OMNode toOM(Reader reader) throws XMLStreamException { return toOM(reader, true); }
private Document getSoapBodyAsDocument(SOAPBody body) { Element element = null; try { element = XMLUtils.toDOM(body.getFirstElement()); } catch (Exception e) { LOG.warn("Converting to W3C Document failed"); } return element.getOwnerDocument(); } }
/** * Gets a new Document read from the indicated uri * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException { // call the authenticated version as there might be // username/password info embeded in the uri. return XMLUtils.newDocument(uri, null, null); }
/** * Creates a new document from the given URI. Uses the username and password * if the URI requires authentication. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException { InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password); Document doc = XMLUtils.newDocument(ins); // Close the Stream if (ins.getByteStream() != null) { ins.getByteStream().close(); } else if (ins.getCharacterStream() != null) { ins.getCharacterStream().close(); } return doc; }
public InputSource resolveEntity(String publicId, String systemId) { return XMLUtils.getEmptyInputSource(); } }
/** * Creates a new document from the given URI. Uses the username and password * if the URI requires authentication. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException { InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password); Document doc = XMLUtils.newDocument(ins); // Close the Stream if (ins.getByteStream() != null) { ins.getByteStream().close(); } else if (ins.getCharacterStream() != null) { ins.getCharacterStream().close(); } return doc; }
public InputSource resolveEntity(String publicId, String systemId) { return XMLUtils.getEmptyInputSource(); } }
/** * Convert DOM Element into a fully built OMElement * @param element dom Element * @return OMElement * @throws Exception */ public static OMElement toOM(Element element) throws Exception { return toOM(element, true); }
/** * Gets a new Document read from the indicated uri * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException { // call the authenticated version as there might be // username/password info embeded in the uri. return XMLUtils.newDocument(uri, null, null); }
private static Assertion unmarshellElement(OMElement omAssertion) throws Exception{ if(omAssertion.getLocalName().equals("Assertion")){ try{ UnmarshallerFactory factory = Configuration.getUnmarshallerFactory (); javax.xml.namespace.QName qname = omAssertion.getQName(); Unmarshaller unmarsh = factory.getUnmarshaller(qname); if(unmarsh == null){ throw new Exception("Unmarshell Exception"); } Assertion assertion; assertion = (Assertion)unmarsh.unmarshall(XMLUtils.toDOM(omAssertion)); return assertion; } catch(Exception e){ throw e ; } } return null ; }
return source; return XMLUtils.getEmptyInputSource(); } catch (Exception e) { throw new SAXException(e);
/** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built. * * @param inputStream * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream) throws XMLStreamException { return toOM(inputStream, true); }
/** * Gets a new Document read from the input stream * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException { return XMLUtils.newDocument(new InputSource(inp)); }
Element elt = XMLUtils.toDOM(element);
return source; return XMLUtils.getEmptyInputSource(); } catch (Exception e) { throw new SAXException(e);
/** * Converts a given inputstream to an OMNode * The reurned OMNode is fully built. * * @param inputStream * @return OMNode * @throws javax.xml.stream.XMLStreamException * */ public static OMNode toOM(InputStream inputStream) throws XMLStreamException { return toOM(inputStream, true); }
/** * Gets a new Document read from the input stream * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException { return XMLUtils.newDocument(new InputSource(inp)); }
protected static void printWSDL(final Document wsdl, final String serviceAddress, final Collection<PolicyComponent> wssPolicies, final OutputStream out) throws Exception { assert wsdl != null; // create a easyWSDL description final Description desc = WSDL4ComplexWsdlFactory.newInstance().newWSDLReader().read(wsdl); // delete imported documents desc.deleteImportedDocumentsInWsdl(new URI(serviceAddress + "?wsdl=")); // recreate a Document without imports final Document descWithoutImport = WSDL4ComplexWsdlFactory.newInstance().newWSDLWriter().getDocument(desc); // And add the WSS-Policy if exists for (final PolicyComponent wssPolicy : wssPolicies) { final OMElement policyElt = PolicyUtil.getPolicyComponentAsOMElement(wssPolicy); final Node policyNode = descWithoutImport.adoptNode(XMLUtils.toDOM(policyElt)); // Remove Apache Rampart configuration from WS-Policy final NodeList rampartConfigElts = ((Element) policyNode) .getElementsByTagNameNS("http://ws.apache.org/rampart/policy", "RampartConfig"); for (int i = 0; i < rampartConfigElts.getLength(); i++) { final Node rampartConfigElt = rampartConfigElts.item(i); rampartConfigElt.getParentNode().removeChild(rampartConfigElt); } descWithoutImport.getDocumentElement().appendChild(policyNode); } XMLPrettyPrinter.prettify(descWithoutImport, out, XMLPrettyPrinter.getEncoding(descWithoutImport)); }