org.apache.cxf.aegis.type.Type aegisType = TypeUtil.getWriteTypeStandalone(context, obj, genericType);
AegisWriter<XMLStreamWriter> aegisWriter = context.createXMLStreamWriter();
try {
XMLStreamWriter xmlStreamWriter = createStreamWriter(aegisType.getSchemaType(), os);
// use type qname as element qname?
xmlStreamWriter.writeStartDocument();
aegisWriter.write(obj, aegisType.getSchemaType(), false, xmlStreamWriter, aegisType);
xmlStreamWriter.writeEndDocument();
xmlStreamWriter.close();
} catch (Exception e) {
throw new WebApplicationException(e);