Bug 974142

Summary: There is no transformer registered from java:java.io.Reader to java:javax.xml.transform.Source
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Jiri Sedlacek <jsedlace>
Component: SwitchYardAssignee: Douglas Palmer <dpalmer>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Sedlacek <jsedlace>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.0.0 GACC: atangrin, oskutka, soa-p-jira
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer app none

Description Jiri Sedlacek 2013-06-13 13:49:25 UTC
Description of problem:
I've got application as provided in attachment, composite with one service, wsdl interface, binding is http. One inner component, bean service with java interface, wsdl generated from this java interface. Added JAXB transformer.

Problem is, that in JAXBUnmarshalTransformer.transform() method, line 69, call on message.getContent(Source.class), it throws exception, Cannot convert from 'java.io.StringReader' to 'javax.xml.transform.Source':

No registered Transformer available for transforming from 'java:java.io.StringReader' to 'java:javax.xml.transform.Source'.  A Transformer must be registered.

There is a class BasicDOMTransformer, which performs some transformations, and it should be able to do it, unfortunately it's not configured in transforms.xml in switchyard/core/transform project. 

The problem is, that even if I add this transformer into my switchyard.xml by this line: 
<transform:transform.java from="java:java.io.Reader" to="java:javax.xml.transform.Source"  class="org.switchyard.transform.ootb.xml.BasicDOMTransformer"/>

it cannot transform it properly. The class hardly depends on DOMSource and thus it doesn't transform fom Reader to Source.

This source is needed in JAXBUnmarshalTransformer and there is no need to have exactly DOMSource, so it would be great if it can transform to javax.xml.transform.Source.

There also may be future performance issues with this DOMTransformer, if it will be the only implementation for transforming from/to xml Source.

Comment 1 Jiri Sedlacek 2013-06-13 13:51:49 UTC
Created attachment 760705 [details]
reproducer app

Attaching reproducer app

Comment 2 Jiri Sedlacek 2013-06-13 14:08:27 UTC
The same or similar issue is for transformation from org.w3c.dom.Element to javax.xml.transform.Source

No registered Transformer available for transforming from 'java:org.apache.xerces.dom.DeferredElementNSImpl' to 'java:javax.xml.transform.Source'.  A Transformer must be registered.

org.apache.xerces.dom.DeferredElementNSImpl is implementation/subclass of org.w3c.dom.Element and then org.w3c.dom.Node, BasicDOMTransformer should be able to make this transformation, but it's not.

I forced this transformer by this line in switchyard.xml: 

<transform:transform.java from="java:org.w3c.dom.Element" to="java:javax.xml.transform.Source"  class="org.switchyard.transform.ootb.xml.BasicDOMTransformer"/>

Comment 3 Keith Babo 2013-06-18 20:28:01 UTC
I agree this can be friendlier and we can improve the coverage of transformers for this use case.  I also thing we can tweak the default data type used by HttpBinding since byte[] is going to result in a copy of the data.

I disagree that this is a blocker since, AFAIK, this is limited to a combination of JAXB and HTTP gateway.  In that scenario, the user can always introduce a converter/transformer on their own to work around the issue.

Comment 5 Keith Babo 2013-11-07 13:54:39 UTC
Doug - as a first pass, can you try to reproduce this on 1.1.0.CR1?  I want to see if this is still an issue before talking about whether something needs to be fixed for FSW 6.0.

Comment 6 Jiri Sedlacek 2013-11-08 09:51:28 UTC
verified in ER6