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 Michael Thome <mt...@bbn.com> on 2006/08/28 15:38:12 UTC

Using axis (wsdl2java-generated) datamodel for (de)serialization to files?

I've been trying to figure out how to serialize/deserialize axis beans 
to/from xml files - obviously all the pieces are there, but I haven't 
figured out quite how to connect them together.  Any suggestions would 
be most welcome.  My intent is to use squirreled-away fragments of 
webservice interactions as part of my unit test suite.

For instance, for deserialization, I was hoping that something like the 
following would work (where Query is a class generated by wsdl2java):
       FileReader fr = new FileReader(filename);
       SAXParser parser = XMLUtils.getSAXParser();
       XMLReader xr = parser.getXMLReader();
       Deserializer des = Query.getDeserializer("ignored", Query.class,
                              Query.getTypeDesc().getXmlType());
       xr.setContentHandler((ContentHandler) des);
       xr.parse(new InputSource(fr));
       Query q = (Query) des.getValue();
       XMLUtils.releaseSAXParser(parser);
But, BeanDeserializer falls back on DefaultHandler's startElement 
(without a context argument) which is a no-op.

I'm just thrashing around at this point - I don't really want to 
serialize/deserialize the whole SOAP message (though I'll do it if I 
need to)

Thanks,
	Michael
-- 
*Michael Thome*
BBN Technologies 10 Moulton St, Cambridge MA 02138 USA
phone: +1 617 873 1853


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org