axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendy Irawan (JIRA)" <>
Subject [jira] [Commented] (AXIS2-2376) Make it optional to output indented XML from Axis2
Date Sat, 28 Apr 2012 20:42:49 GMT


Hendy Irawan commented on AXIS2-2376:

This is how I did it in magja (
) :

        connectOptions = new Options();
        connectOptions.setTo(new EndpointReference(config.getRemoteHost()));
        connectOptions.setProperty(HTTPConstants.MC_GZIP_REQUEST, true);
        connectOptions.setProperty(HTTPConstants.MC_ACCEPT_GZIP, true);

        // to use the same tcp connection for multiple calls
        // workaround:
        MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
        HttpClient httpClient = new HttpClient(httpConnectionManager);
                .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);

    	// Useful during HTTP debugging
//		HttpTransportProperties.ProxyProperties proxyProps = new HttpTransportProperties.ProxyProperties();
//		proxyProps.setProxyName("localhost");
//		proxyProps.setProxyPort(8008);
//		proxyProps.setUserName("guest");
//		proxyProps.setPassWord("guest");
//		connectOptions.setProperty(HTTPConstants.PROXY, proxyProps);
        sender = new ServiceClient();

    	sender.getServiceContext().setProperty(Constants.Configuration.MESSAGE_FORMATTER, new
SOAPMessageFormatter() {
    		public String formatSOAPAction(MessageContext msgCtxt,
    				OMOutputFormat format, String soapActionString) {
    			format.setStAXWriterConfiguration(new StAXWriterConfiguration() {
					public XMLOutputFactory configure(XMLOutputFactory factory,
							StAXDialect dialect) {
						StaxUtilsXMLOutputFactory indentingFactory = new StaxUtilsXMLOutputFactory(factory);
						indentingFactory.setProperty(StaxUtilsXMLOutputFactory.INDENTING, true);
						return indentingFactory;
    			return super.formatSOAPAction(msgCtxt, format, soapActionString);

For the record, it works wonderfully.

Tip: Enable gzip compression for both request and accept, and save lots of bandwidth :-)
> Make it optional to output indented XML from Axis2
> --------------------------------------------------
>                 Key: AXIS2-2376
>                 URL:
>             Project: Axis2
>          Issue Type: Improvement
>    Affects Versions: 1.1.1
>            Reporter: Jonas Bo√ęthius
>            Priority: Minor
> For readability of XML, and therefore also helping the initial integration towards a
web service, it would be good to be able to e.g. configure the server side to return indented
("pretty printed") XML. From what I know, there is no specific recommendation against indenting
XML in SOAP (like WS-I etc). Axis version 1.1 returned indented XML by default.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message