dnaranjor
dnaranjor

Reputation: 31

Simple Man Guide to create a Camel Route in JBoss Fuse on JBoss EAP 6.4 for a SOAP Proxy

I have a Web Service exposed to the public and I'd like to hide it using Fuse as a front end to outside requests. I think I have to configure a Camel Proxy to achieve that.

In a development environment (a Windows 7 x64 machine) I've succesfully installed and tested the jdk-8u111-windows-x64, apache-maven-3.3.9, jboss-eap-6.4.0-installer, fuse-eap-installer-6.3.0.redhat-187 and devstudio-integration-stack-9.0.2.GA-standalone-installer, and I'm using JBoss Dev Studio 9.1.0.GA.

Currently I'm trying to figure how can I use JBoss Developer Studio 9.1.0.GA to consume a public Web Service (http://www.webservicex.net/country.asmx) and after that, deploy it as a brand new web service with a different name (doing exactly the same as the original, of course) in my local standalone Fuse server.

I've reviewed tons of Blogs, articles, Red Hat tutorials, videos for about a week or two, but I'm simply giving myself up with this. Is that hard?

Upvotes: 1

Views: 338

Answers (1)

Shoaib Khan
Shoaib Khan

Reputation: 939

It's pretty straight forward to proxy the actual web service using Camel.

See below (Considering Country Web services from the Endpoint you mentioned above) with minimal routing you could achieve this. However, depending on your use case such as if you need to further validate, perform some processing logic or do some transformation during mediation you could do that as well.

But at the minimum just to proxy request from your custom endpoint to actual endpoint this is what required:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">


    <!-- CurrencyService Proxy Endpoint -->
    <cxf:cxfEndpoint id="currencyServiceProxyEP" xmlns:c="http://www.webserviceX.NET"  
        endpointName="c:countrySoap" serviceName="c:country"
        loggingFeatureEnabled="true" address="/CurrencyService/MyGatewayProxy" wsdlURL="WSDL/CountryService.wsdl">
        <cxf:properties>
            <entry key="dataFormat" value="MESSAGE" /> 
        </cxf:properties>
    </cxf:cxfEndpoint>


    <!-- CurrencyService Actual Endpoint -->
    <cxf:cxfEndpoint id="currencyServiceActualEP" xmlns:c="http://www.webserviceX.NET"  
        endpointName="c:countrySoap" serviceName="c:country"
        loggingFeatureEnabled="true" address="http://www.webservicex.net/country.asmx" wsdlURL="WSDL/CountryService.wsdl">
        <cxf:properties>
            <entry key="dataFormat" value="MESSAGE" /> 
        </cxf:properties>
    </cxf:cxfEndpoint>




  <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="CountryService-Context">

        <route id="proxyEPRoute">

            <from uri="cxf:bean:currencyServiceProxyEP" />          

            <!-- Do Extra validation of payload, additional routing, processing, transaformation, mediation etc.. depending on your use case here.. -->

            <to uri="cxf:bean:currencyServiceActualEP"/>


        </route>

  </camelContext>

</blueprint>

Do note: I'm using Camel route with Blueprint DSL and Camel CXF for exposing and consuming SOAP Endpoints.

Upvotes: 1

Related Questions