Bug 974142 - There is no transformer registered from java:java.io.Reader to java:javax.xml.transform.Source
There is no transformer registered from java:java.io.Reader to java:javax.xml...
Status: CLOSED CURRENTRELEASE
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard (Show other bugs)
6.0.0 GA
Unspecified Unspecified
unspecified Severity urgent
: ---
: ---
Assigned To: Douglas Palmer
Jiri Sedlacek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-13 09:49 EDT by Jiri Sedlacek
Modified: 2015-08-02 19:44 EDT (History)
3 users (show)

See Also:
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: ---


Attachments (Terms of Use)
reproducer app (2.57 KB, application/x-compressed-tar)
2013-06-13 09:51 EDT, Jiri Sedlacek
no flags Details

  None (edit)
Description Jiri Sedlacek 2013-06-13 09:49:25 EDT
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 09:51:49 EDT
Created attachment 760705 [details]
reproducer app

Attaching reproducer app
Comment 2 Jiri Sedlacek 2013-06-13 10:08:27 EDT
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 16:28:01 EDT
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 08:54:39 EST
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 04:51:28 EST
verified in ER6

Note You need to log in before you can comment on or make changes to this bug.