SPRING-WS

The SPRING-WS component allows to call web service (i.e. performing SOAP requests) in a simple way. Learn how to work with the SPING-WS component.

Library

To install camel-spring-ws you can use the managed libraries or manually upload the library jars with their dependencies.

Routes

Since release 20180625, the library needs to be attached to the route, see How to use libraries in a context route

Now it's possible to create a route that uses this component. Here the definition of the route:

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <!-- Call only one time -->
        <from uri="timer:foo?repeatCount=1"/>
        <!-- Prepare the SOAP request -->
        <setBody>
            <constant><![CDATA[<getTableContent><table>host</table></getTableContent>]]></constant>
        </setBody>
        <!-- Send the SOAP request and convert the result as String -->
        <to uri="spring-ws:https://localhost:7777/webservice.php"/>
        <convertBodyTo type="java.lang.String"/>
        <!-- Log the result -->
        <to uri="log:ws-results"/>
    </route>
</routes>

Related Links