Andy,
This should make your boss happy:
public static Document serializeFromBinding(Object object, QName qname)
throws ApplicationException {
MessageContext msgContext = new MessageContext(new
AxisServer());
msgContext.setEncodingStyle(null);
TypeMappingRegistry tmr = new TypeMappingRegistryImpl();
msgContext.setTypeMappingRegistry(tmr);
StringWriter writer = new StringWriter(); //temp
SerializationContext ser = new SerializationContext(writer,
msgContext);
ser.setPretty(true);
ser.setSendDecl(false);
ser.setDoMultiRefs(false);
try {
ser.serialize(qname, new AttributesImpl(), object, null,
Boolean.FALSE, Boolean.FALSE);
writer.flush();
return XMLUtils.newDocument(new InputSource(new
StringReader(writer.toString())));
}
catch(ParserConfigurationException e) {
throw new ApplicationException(e.getMessage(), e);
}
catch(SAXException e) {
throw new DocumentStructureException(e.getMessage(), e);
}
catch(IOException e) {
throw new ApplicationException(e.getMessage(), e);
}
}
Yves
On Fri, 2005-11-11 at 18:10 -0500, Andy Foster wrote:
> Hi all,
>
> I'm at my last chance now, so if someone can help that would be great else
> I'm going to have to hand code XML output.
>
> If you use WSDL2JAVA to generate stubs and call them you get a java response
> object back that represents the XML response
>
> I need to get that response back into XML not the stub java representation.
>
> I know axis can re serialise for me I just do not know how to invoke it
>
> Please help as I have been searching for two days now and my boss is giving
> me the weekend and then we have to find another way to hand crank it which
> would be a very poor solution
>
> Andy