You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ki...@sybase.com on 2004/09/22 21:15:13 UTC

Serializing WSDL generated javatypes to a string

I am trying to persist the value in a text column in  a database.
I am using XmlSerializer to serialize it, but I dont see any output.
I have enclosed the code which does this. ost.size() turns out to be zero.

                        org.apache.axis.encoding.Serializer s = 
ValueType.getSerializer("", ValueType.class, 
ValueType.getTypeDesc().getXmlType());
 
                        MessageContext mctx = new 
MessageContext(context.getEngine());
                        mctx.setEncodingStyle("UTF-8");
                        System.out.println("enc style " + 
mctx.getEncodingStyle());
                        byte buf[] = new byte[4096];
                        ByteArrayOutputStream ost = new 
ByteArrayOutputStream(4096);
                        SerializationContext ctx = new 
SerializationContextImpl(new OutputStreamWriter(ost), mctx);
                        System.out.println("ctx " + ctx);
                        s.serialize(ValueType.getTypeDesc().getXmlType(), 
null, value, ctx);
                        System.out.println("buf " + ost.size());


Regards,
- kiru