|
Page Edited :
SM :
servicemix-saxon
servicemix-saxon has been edited by Guillaume Nodet (Jul 18, 2008). Content:servicemix-saxonThe servicemix-saxon component is a standard JBI Service Engine for XSLT / XQuery. This component is based on Saxon
Using servicemix-saxon as a standard JBI componentInstallationInstalling the servicemix-saxon component can be done in several ways:
Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console. Service Unit packagingA service unit will typically consist in:
Content of xbean.xml file to be packaged as a SU <beans xmlns:saxon="http://servicemix.apache.org/saxon/1.0">
... add endpoints here ...
</beans>
Using servicemix-saxon in a ServiceMix xml configuration file<beans xmlns:sm="http://servicemix.apache.org/config/1.0" xmlns:saxon="http://servicemix.apache.org/saxon/1.0"> <sm:container ...> <sm:activationSpecs> <sm:activationSpec> <sm:component> <saxon:component> <saxon:endpoints> ... add saxon endpoints here ... </saxon:endpoints> </saxon:component> </sm:component> </sm:activationSpec> ... </sm:activationSpecs> </sm:container> ... </beans> XSLT EndpointThe XSLT endpoint can be used to apply an XSLT stylesheet to the incoming exchange and will return the transformed result as the output message. Simple transformation: <saxon:xslt service="test:xslt" endpoint="endpoint" resource="classpath:transform.xsl" /> Dynamic stylesheet selection: <saxon:xslt service="test:xslt-dynamic" endpoint="endpoint"> <saxon:_expression_> <bean class="org.apache.servicemix._expression_.PropertyExpression"> <property name="property" value="xslt.source" /> </bean> </saxon:_expression_> </saxon:xslt>
XSLT ProxyOne common use case is the need to transform a request coming from a service and send it to another service and do the same with the response. A simple example is the need to translate the request and responses between two SOAP endpoints. Such a use case could be implemented using two XSLT endpoints and an EIP StaticRoutingSlip. However, there are some drawbacks, as the operation is lost in the process, and a static routing slip can not be used to process InOnly exchanges. The 4.0 version of servicemix-saxon provides such a feature in a single endpoint: <saxon:proxy service="test:proxy" endpoint="endpoint" resource="classpath:transform-in.xsl" outResource="classpath:transform-out.xsl" faultResource="classpath:transform-fault.xsl"> <saxon:target> <saxon:exchange-target service="test:echo" /> </saxon:target> </saxon:proxy>
XQuery endpointThe XQuery endpoint can be used to apply a selected XQuery to the input document. Simple XQuery: <saxon:xquery service="test:xquery" endpoint="endpoint" resource="classpath:query.xq" /> Inlined XQuery with specific output configuration: <saxon:xquery service="test:xquery-inline" endpoint="endpoint"> <saxon:query> for $x in /bookstore/book where $x/price > 30 return $x/title </saxon:query> <saxon:outputProperties> <saxon:property key="{http://saxon.sf.net/}wrap-result-sequence">yes</saxon:property> </saxon:outputProperties> </saxon:xquery> Dynamic selection of XQuery: <saxon:xquery service="test:xquery-dynamic" endpoint="endpoint"> <saxon:_expression_> <bean class="org.apache.servicemix._expression_.PropertyExpression"> <property name="property" value="xquery.source" /> </bean> </saxon:_expression_> </saxon:xquery>
|
Unsubscribe or edit your notifications preferences
