Red Hat Bugzilla – Bug 779168
XsltAction - Custom SourceResult is not properly documented
Last modified: 2010-02-12 05:21:48 EST
Date of First Response: 2010-01-06 00:30:28
Custom SourceResult needs to have resultType set to SOURCERESULT if the original result has to be used. Otherwise resultType must be in conformance with the SourceResult that was created by previous action in pipeline.
Sorry I'm not sure I understand this.
As far as I know, if resultType is set to SOURCERESULT: the direct output of the transform is the result that is returned by the action. It is not cast into another type.
I'm not sure what you mean by "Otherwise resultType must be in conformance with the SourceResult that was created by previous action in pipeline"
Ah I think I understand.
If your payload is a SourceResult object:
Setting the resultType to SOURCERESULT will return a result object of the same type as the result attribute of the payloads SourceResult object.
Otherwise the result will be cast to the type specified in resultType and you must ensure that the type-cast is valid.
and method process in http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java
You can send SourceResult object as the payload of the message sent to action.
If resultType is set to SOURCERESULT then the action will write a result directly to the object represented by result attribute of the payload's SourceResult object and the output of the action will be this result object.
Setting the resultType to something else like String, then the action will expect that result attribute is of type StreamResult, etc. see method extractResult and the output of the action id converted object.
Which is almost the same as you written just instead of type-cast valid is probably better said conversion compatible or similar.
added SOURCERESULT to the list of resultTypes with the description:
When the message payload contains a SourceResult object this produces a result of the same type as the result attribute of the payload's SourceResult object.
and after the list of resultTypes I added this paragraph:
When the message payload is a SourceResult object and resultType is not set to SOURCERESULT, the result is returned as the type specified in resultType. The developer is responsible for ensuring that the types are compatible.
Verified in CR1