Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.xml.transform.Transformer bug?

843834Oct 21 2008 — edited Oct 22 2008
Hi there,

I'm currently having a problem with the Transformer class that forced me to implement a "dirty" work-around. My objective is, starting with a SOAPMessage, being able to marshall a given node of the SOAPBody payload to an OutputStream.

I do that with the following code:
// "message" is a well-formated SOAPMessage.
SOAPBody body=message.getSOAPBody();
Node node=...
Transformer transformer=TransformerFactory.newInstance().newTransformer();
// "output" is the OutputStream.
transformer.transform(new DOMSource(node), new StreamResult(output));
It all works fine in the unit tests and standalone execution... The problem shows up when this code is integrated in our enterprise application, that runs on Tomcat. Instead of mashalling just the node tree, the transformer is marshalling THE WHOLE document! I proved that by caching the transformer output to a ByteArrayOutputStream and inspecting the results.

Deep cloning the node, which should remove all the parent elements, also doesn't work. I removed all the legacy XML APIs (xercesImpl.jar, xml-apis.jar, etc.) and the problem still persists.

I'm using Metro 1.3 on Java 1.5.0_10 in Windows XP. Tomcat version is 5.5.23.

Did any of you kind readers experienced this behaviour before? Thank you a lot in advance, cheers,

AP
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2008
Added on Oct 21 2008
2 comments
294 views