1 Reply Latest reply on Jun 30, 2014 9:35 AM by Keith Babo

    XSLT Transformer is not called (when i need it to ;-)

    Dennis Bohnstedt Hansen Newbie



      Is there a way to indicate a bit more precisely to SwitchYard, where a transformation should be done? It seems that most of the Switchyard transformation, that is done using Transformers, are happening between a promoted interface and the service it promotes, but sometimes it would be nice to have the transformation done at some point after the first Component is hit.



      An example of this, is if I want to somehow keep the original message for later use. In one application we want to store an original EDI message before transforming it to XML, and the same could be needed with XML messages, before transforming them with XSLT.


      In the attached example, I've added another service to the Transform-xslt quickstart, where i would like the Switchyard XSLT transformation to be done on the wire between OrderService and AcknowledgeValidater, but when the example is run, it looks as if Switchyard doesn't pick up the need for Transformation, and the "type" of the String is completely ignored all the way back to after OrderServiceBean returns. I've indicated what i would like to happen using @OperationTypes, but that information seem to be ignored. What is propably needed, is a way to indicate on a @Reference, that the String i'm sending it, is of type "{urn:switchyard-quickstart:transform-xslt:1.0}orderAck", since SwitchYard otherwise doesn't know what has happend to the String, since it was received by the OrderService.


      Another way would be to completely detach the type of the @Reference, by using an invoker of sorts, and use Switchyard Transformations for Service interfaces with types as well. When implementing services using Java Beans, you are more or less forced to do the Transformation yourself (or by calling the Transformer code directly, before calling the @Reference's service).





        • 1. Re: XSLT Transformer is not called (when i need it to ;-)
          Keith Babo Master

          If you want a transformation to occur on the message path between OrderService and AcknowledgmentValidator, the message types need to be different between the reference that's used in OrderService and the service provided in AcknowledgmentValidator (right now, they are the same 'org.switchyard.quickstarts.transform.xslt.AcknowledgerValidator'). 


          Re: your question on storing original versions of messages, there are two interception points on each message path (two for request, two for response).  This means an ExchangeInterceptor can be used to store the message pre-transformation, post-transformation, or both.