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;        }       } 

refer http://javasourcecode.org/html/open-source/jdk/jdk-6u23/com/sun/xml/internal/ws/developer/jaxbcontextfactory.html


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -