java - remove whitespaces from jaxb xml response -
i have ws generates soap xml message. due size limitations remove unnecessary whitespaces (used indentation) , new lines. how can when using generated classes , annotations (@webservice , @webmethod)? in examples have seen done this:
marshaller m = jc.createmarshaller(); m.setproperty(marshaller.jaxb_formatted_output, boolean.false); however, not manually creating marshaller not know can add property , if correct way of doing it. jaxb implementation axis2.
create custom jaxbcontext , annotate webservice mentioned below:
@webservice(servicename = "hello") @usesjaxbcontext(value = customjaxbcontext.class) public class hellows { ... } public class hellojaxbcontext implements jaxbcontextfactory { @override public jaxbricontext createjaxbcontext(seimodel seim, list<class> classestobind, list<typereference> typereferences) throws jaxbexception { //jaxbricontext extends jaxbcontext, should able set desired marshaller properties //create jaxb context necessary properties marshalling return yourjaxbricontext; } }
Comments
Post a Comment