[jbossws-issues] [JBoss JIRA] Updated: (JBWS-2526) org.jboss.ws.core.soap.TextImpl does not implement org.w3c.dom.Comment
Gerald Turner (JIRA)
jira-events at lists.jboss.org
Thu Feb 12 20:45:44 EST 2009
[ https://jira.jboss.org/jira/browse/JBWS-2526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gerald Turner updated JBWS-2526:
--------------------------------
Attachment: jbws2526.patch
Attached patch with test case and bug fix.
> org.jboss.ws.core.soap.TextImpl does not implement org.w3c.dom.Comment
> ----------------------------------------------------------------------
>
> Key: JBWS-2526
> URL: https://jira.jboss.org/jira/browse/JBWS-2526
> Project: JBoss Web Services
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: jbossws-native
> Affects Versions: jbossws-native-3.0.5
> Environment: JBoss 4.2.3.GA with jbossws-native-3.0.5.jar upgrade
> Reporter: Gerald Turner
> Attachments: jbws2526.patch
>
>
> I have encountered a bug with JBossWS in a LogicalHandler that I have written. This handler serializes the Payload to a String using ordinary Transformer API. When the Payload contains an XML comment, a ClassCastException is thrown from within Xalan's TreeWalker class. TreeWalker casts the node to an org.w3c.dom.Comment.
> Here's the partial source to the handler:
> public boolean handleMessage(LogicalMessageContext context) {
> if (JAXWSUtil.isInbound(context)) {
> LogicalMessage message = context.getMessage();
> Source payload = message.getPayload();
> context.put("com.blah.blah.inbound.message.payload", payload);
> }
> return true;
> }
> public boolean handleFault(LogicalMessageContext context) {
> LogicalMessage message = context.getMessage();
> Source outboundPayload = message.getPayload();
> String outboundXML = JAXWSUtil.toString(outboundPayload);
> Source inboundPayload = (Source) context.get("com.blah.blah.inbound.message.payload");
> String inboundXML = JAXWSUtil.toString(inboundPayload); // throws ClassCastException
> sendAlarm("The following fault occurred:\n\n" + outboundXML
> + "\n\nRequest:\n" + inboundXML);
> return true;
> }
> JAXWSUtil uses Transformer API like so:
> public static String toString(Source payload) {
> TransformerFactory factory = getTransformerFactory();
> Transformer transformer = factory.newTransformer();
> transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
> transformer.setOutputProperty(OutputKeys.INDENT, "yes");
> transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2");
> StringWriter output = new StringWriter();
> StreamResult result = new StreamResult(output);
> transformer.transform(payload, result);
> return output.toString();
> }
> Here's the ClassCastException stacktrace:
> java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl
> at org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:287)
> at org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:143)
> at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:389)
> at com.xo.nextgen.hvodwebservice.util.xslt.TransformerWrapper.transform(TransformerWrapper.java:42)
> at com.xo.nextgen.hvodwebservice.util.JAXWSUtil.toString(JAXWSUtil.java:272)
> at com.xo.nextgen.hvodwebservice.wsdl.handler.FaultNotificationHandler.handleFault(FaultNotificationHandler.java:147)
> at com.xo.nextgen.hvodwebservice.wsdl.handler.AbstractLogicalHandler.handleFault(AbstractLogicalHandler.java:1)
> at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleFault(HandlerChainExecutor.java:318)
> at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleFault(HandlerChainExecutor.java:216)
> at org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS.callFaultHandlerChain(HandlerDelegateJAXWS.java:131)
> at org.jboss.ws.core.server.ServiceEndpointInvoker.callFaultHandlerChain(ServiceEndpointInvoker.java:140)
> at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:284)
> at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
> Here is the code to Xalan-2.7.0 TreeWalker around line 287:
> switch (node.getNodeType())
> {
> case Node.COMMENT_NODE :
> {
> String data = ((Comment) node).getData(); // throws ClassCastException
> My project had been working with the JAX-WS Reference Implementation under JBoss 4.0 and I am in the process of converting the project to JBossWS so that it may be deployed on JBoss 4.2+. I mention this because I peeked into how the JAX-WS RI dealt with the javax.xml.soap.Text interface and it appears that Sun's SAAJ has distinct TextImpl and CommentImpl classes.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbossws-issues
mailing list