@Test
public void testToEnvelope() throws Exception {

	Resource resource = new ClassPathResource("org/springframework/ws/soap/soap11/soap11.xml");
	byte[] buf = FileCopyUtils.copyToByteArray(resource.getFile());
	String expected = new String(buf, "UTF-8");
	DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance();
	documentBuilderFactory.setNamespaceAware(true);
	DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
	Document document = documentBuilder.parse(SaxUtils.createInputSource(resource));
	SOAPEnvelope envelope = AxiomUtils.toEnvelope(document);
	StringWriter writer = new StringWriter();
	envelope.serialize(writer);
	String result = writer.toString();
	assertXMLEqual("Invalid SOAPEnvelope generated from document", expected, result);
}