Do you invoke the service via http? I.e. using the …/invoke/service.path URL? Then just set the Accept header of the request to the desired mime type, and the server will return the data in the desired format. I think, HTML, XML and JSON are supported (at least).
This is a better way IMO since you don’t need to modify the service and the client decides which format should be delivered.
#Integration-Server-and-ESB#webMethods