For a http proxy then see this page
http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

As you need to enable a few options and its better to use jetty for
both ends (it scales much better than the http component can do)

On Wed, Nov 13, 2013 at 9:55 PM, Daniel Kulp <[email protected]> wrote:
>
> If it’s just going to be a simple straight through proxy, you’re likely 
> better off to just do:
>
>    <camelContext xmlns="http://camel.apache.org/schema/spring";>
>        <route>
>            <from uri=“jetty:http://localhost:8080/HelloService"; />
>            <to uri="http://localhost:8081/axis2/services/HelloService"/>
>        </route>
>    </camelContext>
>
> Simple stream of bytes comes in, gets sent to the axis2 service, response 
> just streamed back.
>
> Dan
>
>
>
> On Nov 13, 2013, at 9:41 AM, madusanka <[email protected]> wrote:
>
>> I need to expose a web service using Camel. Scenario is like this. There are
>> three computers. Service provider, ServiceMix and service consumer are
>> deployed in these three computers (for development purposes all there are in
>> the localhost).
>> ServiceMix acts like a proxy here. I have already developed the provider and
>> consumer using Axis2.
>>
>> Steps I followed:
>>
>> (1)Created a project using the following maven command
>>
>> mvn archetype:generate
>> -DarchetypeGroupId=org.apache.camel.archetypes
>> -DarchetypeArtifactId=camel-archetype-spring -DarchetypeVersion=2.10.5
>> -DgroupId=com.camel.examples
>> -DartifactId=HelloSerice -Dversion=1.0-SNAPSHOT
>>
>>
>> (2)Added the routing rule in camel-context.xml file
>>
>> "actualEndpoint" refers to the actual web service.
>>
>> <beans xmlns="http://www.springframework.org/schema/beans";
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>        xmlns:cxf="http://camel.apache.org/schema/cxf";
>>        xsi:schemaLocation="
>>        http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>        http://camel.apache.org/schema/cxf
>> http://camel.apache.org/schema/cxf/camel-cxf.xsd
>>        http://camel.apache.org/schema/spring
>> http://camel.apache.org/schema/spring/camel-spring.xsd";>
>>
>>    <cxf:cxfEndpoint id="proxyEndpoint"
>>                     address="http://localhost:8080/HelloService"/>
>>
>>    <cxf:cxfEndpoint id="actualEndpoint"
>>
>> address="http://localhost:8080/axis2/services/HelloService";
>>
>> wsdlURL="http://localhost:8080/axis2/services/HelloService?wsdl";
>>                     endpointName="tns:HelloServicePort"
>>                     serviceName="tns:HelloService"
>>                     xmlns:tns="http://tempuri.org/HelloService"; />
>>
>>
>>    <camelContext xmlns="http://camel.apache.org/schema/spring";>
>>        <route>
>>            <from uri="cxf:bean:proxyEndpoint" />
>>            <to uri="cxf:bean:actualEndpoint"/>
>>        </route>
>>    </camelContext>
>>
>> </beans>
>>
>>
>> (3)But when I depolyed into ServiceMix, following exception is thrown. It
>> says to specify serviceClass. But the service provider is remote and written
>> in Axis2. Please help me to resolve this
>>
>> Exception in thread "SpringOsgiExtenderThread-23"
>> org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException:
>> serviceClass must be specified
>>       at
>> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1326)
>> 2013-11-13 20:01:32,442 | ERROR | xtenderThread-23 | ContextLoaderListener
>> | 82 - org.springframework.osgi.e     at
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
>> xtender - 1.2.1 | Application context refresh failed
>> (OsgiBundleXmlApplicationContext(bundle=HelloSerice, config=osgibundle:/MET
>> at
>> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:285)
>> A-INF/spring/*.xml))
>>       at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
>> org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException:
>> serviceClass must be specified
>>       at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
>>       at
>> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1326)[100:org.apache.camel.camel-core:2.10.6]
>> at
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
>>       at
>> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
>>
>>       at
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)[102:org.apache.camel.camel-spring:2.10.6]
>>       at
>> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:285)[102:org.apache.camel.camel-spring:2.10.6]
>>       at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[73:org.springframework.context:3.0.7.RELEASE]
>>       at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[73:org.springframework.context:3.0.7.RELEASE]
>>       at
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[73:org.springframework.context:3.0.7.RELEASE]
>>       at
>> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[79:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[79:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[79:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[79:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[82:org.springframework.osgi.extender:1.2.1]
>>       at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]
>> Caused by: java.lang.IllegalArgumentException: serviceClass must be
>> specified
>>       at
>> org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:295)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.component.cxf.CxfSpringEndpoint.createServerFactoryBean(CxfSpringEndpoint.java:177)[173:org.apache.camel.camel-cxf:2.10.6]
>>       at
>> org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:62)[173:org.apache.camel.camel-cxf:2.10.6]
>>       at
>> org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:203)[173:org.apache.camel.camel-cxf:2.10.6]
>>       at
>> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:80)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.RouteService.warmUp(RouteService.java:133)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2011)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1939)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1727)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1608)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1475)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)[102:org.apache.camel.camel-spring:2.10.6]
>>       at
>> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1443)[100:org.apache.camel.camel-core:2.10.6]
>>       at
>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)[102:org.apache.camel.camel-spring:2.10.6]
>>       at
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)[102:org.apache.camel.camel-spring:2.10.6]
>>       ... 10 more
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
>>       at
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>>       at
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
>>       at java.lang.Thread.run(Thread.java:662)
>> Caused by: java.lang.IllegalArgumentException: serviceClass must be
>> specified
>>       at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:295)
>>       at
>> org.apache.camel.component.cxf.CxfSpringEndpoint.createServerFactoryBean(CxfSpringEndpoint.java:177)
>>       at 
>> org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:62)
>>       at
>> org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:203)
>>       at
>> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65)
>>       at
>> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:80)
>>       at org.apache.camel.impl.RouteService.warmUp(RouteService.java:133)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2011)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1939)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1727)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1608)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1475)
>>       at
>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)
>>       at 
>> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>>       at
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1443)
>>       at
>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)
>>       at
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)
>>       ... 10 more
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Exposing-a-Remote-Web-Service-written-in-Axis2-tp5743186.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
> --
> Daniel Kulp
> [email protected] - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to