File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes How to suppress Axis body content encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to suppress Axis body content encoding" Watch "How to suppress Axis body content encoding" New topic

How to suppress Axis body content encoding

Eric Ma

Joined: Nov 21, 2001
Posts: 16
I have a stateless session bean method that returns well-formed XML. This method is then turned into a Web Services method using Axis. Using an Java Axis client, there is no problem processing the XML returned. However, with a VB6 client which uses MSXML DOM parser, it complains the XML is not well-formed. The reason is that Axis encoded the < and > characters in XML into < and >, and MS XML parser does not automatically decode these. I would like to know whether it is possible to turn off such encoding in Axis so that I don't incur overhead with conversion?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
I assume you're "returning" the XML as a String, right? If that's the case, Axis will always encode your XML as text instead of XML. If you want to create a document-style web service which returns a custom XML structure, you need to use org.w3c.dom.Element as the method argument and return type in your web service class.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: How to suppress Axis body content encoding
It's not a secret anymore!