outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
}
XMLStreamWriter out = outputFactory.createXMLStreamWriter(buffer);
out.writeStartDocument();
out.writeStartElement("env", "Envelope", SOAP12);
out.writeNamespace("env", SOAP12);
out.writeNamespace("test", "http://someTestUri");
out.writeStartElement("env", "Body", SOAP12);
out.writeStartElement("test");
out.writeAttribute("foo", "bar");