SerializationContext context = new SerializationContext(stringWriter, msgContext);
context.setDoMultiRefs(multiref);
// Create a TypeMapping and register the specialized Type Mapping
TypeMappingRegistry reg = context.getTypeMappingRegistry();
TypeMapping tm = (TypeMapping) reg.createTypeMapping();
tm.setSupportedEncodings(new String[] {Constants.URI_DEFAULT_SOAP_ENC});
reg.register(Constants.URI_DEFAULT_SOAP_ENC, tm);
QName dataQName = new QName("typeNS", "Data");
tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());