axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Gaffga" <cgaf...@triplemind.com>
Subject serialize a Bean with Axis
Date Mon, 18 Aug 2003 18:03:20 GMT
Hi,
I have a very simple test Bean, I want to serialize to System.out. Is this
possible?

I tried it like this:

      QName qname = new QName("TestXMLSerializerQName");
      AttributesImpl attr = new AttributesImpl();
      PrintWriter writer = new java.io.PrintWriter(System.out);

      SerializationContextImpl ctx = new SerializationContextImpl(writer);
      ctx.setSendDecl(true);
      ctx.setPretty(true);

      ctx.serialize(qname, attr, new Integer(22));
      ctx.serialize(qname, attr, this);

      writer.close();

I get

<?xml version="1.0" encoding="UTF-8"?>
<TestXMLSerializerQName xsi:type="xsd:int"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">22</TestXMLSerializerQName>

without the "ctx.serialize(qname, attr, this);"-line. Otherwise I get:

java.io.IOException: No serializer found for class
com.triplemind.samples.TestXMLSerializer in registry
org.apache.axis.encoding.DefaultTypeMappingImpl@ecb281

What to do to avaid this exception?

Regards
Christoph

P.S.: Didn't found anything on the list, perheaps I missed it.








Mime
View raw message