Tin Ng
Tin Ng

Reputation: 1047

Camel Http proxy to Web services

I've been reading a bit about Camel and going through some of the examples in the download directory.

I would like to know if I can configure the route to accept an incoming Http request with a parameter name=fred using jetty: or servlet:

I then need to convert this to a real secured SOAP request (HTTPS) and get back the SOAP response.

Do I have to write Java code to send the SOAP request? The examples I've seen so far is using SOAP as input, modify some values and send it on as SOAP...

Anyone please provide some guidance with minimal code?

Thanks & regards Tin

Upvotes: 0

Views: 1090

Answers (1)

Tin Ng
Tin Ng

Reputation: 1047

Here is what I've done and it works.. velocity_template.vm contains the entire SOAP request with dynamic fields substituted at runtime eg. ${in.headers.name}

<?xml version="1.0" encoding="UTF-8"?>

<!-- START SNIPPET: e1 -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">

    <cxf:cxfEndpoint id="real_webservice"
                     address="url_to_wsdl?wsdl"
                     endpointName="s:Real_impl_class"
                     xmlns:s="real_namespace"/>

    <camelContext xmlns="http://camel.apache.org/schema/spring">

        <route id="helloRoute">
          <from uri="servlet:///hello"/>
          <to uri="velocity:etc/velocity_template.vm"/>
          <to uri="cxf:bean:real_webservice?dataFormat=MESSAGE"/>
        </route>

  </camelContext>

</beans>
  <!-- END SNIPPET: e1 -->

Upvotes: 1

Related Questions