You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marcin Cylke <mc...@touk.pl> on 2011/08/01 15:11:06 UTC

cxf bean exposed via camel

Hi

I'm trying to expose cxf service bean via cxf-camel transport. Basically 
I want my bean to be accessible via JBI in Servicemix 4 - some other 
services refer this service by jbi endpoints. Theses services are also 
camel routers.

Unfortunatelly the whole setup fails, the cxf bean never receives the 
request.

I'm using Camel 2.6 with servicemix 4.3 Fuse.

I have the following config:

#v+
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:pc="http://some.endpoint.com"
        xmlns:cxf="http://camel.apache.org/schema/cxf"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
        xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                            http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
                            http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd
                            http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
                            http://servicemix.apache.org/cxfse/1.0 
http://servicemix.apache.org/schema/servicemix-cxf-se-2009.01.xsd">


   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

   <import resource="dao-context.xml"/>

     <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />


     <bean 
class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
       <property name="bus" ref="cxf" />
       <property name="camelContext" ref="camelContext" />
       <property name="checkException" value="true" />
       <property name="transportIds">
         <list>
           <value>http://cxf.apache.org/transports/camel</value>
         </list>
       </property>
     </bean>

     <jaxws:endpoint
         id="PCService"
         address="camel://direct:PCService"
         endpointName="default" serviceName="pc:PCService-1"
         implementor="pl.service.PCServiceImpl">
         <jaxws:features>
             <logging xmlns="http://cxf.apache.org/core" />
         </jaxws:features>
     </jaxws:endpoint>

     <camel:camelContext id="camelContext" trace="true" 
xmlns="http://camel.apache.org/schema/spring">
             <route>
                 <from 
uri="jbi:service:http://some.endpoint.com/Endpoint-1/default" />
                 <to uri="direct:PCService" />
             </route>
     </camel:camelContext>


</beans>
#v-

Thanks in advance for any assistance.

Marcin

Re: cxf bean exposed via camel

Posted by Willem Jiang <wi...@gmail.com>.
I cannot tell any thing is wrong from your configuration.
Can you double check the JBI endpoint uri[1] to make sure you servicemix 
client can access the enpdoint?

BTW, you may need to go through the servicemix log to check if there 
error message which is related to access the JBI endpoint.

Willm
On 8/1/11 9:11 PM, Marcin Cylke wrote:
> Hi
>
> I'm trying to expose cxf service bean via cxf-camel transport. Basically
> I want my bean to be accessible via JBI in Servicemix 4 - some other
> services refer this service by jbi endpoints. Theses services are also
> camel routers.
>
> Unfortunatelly the whole setup fails, the cxf bean never receives the
> request.
>
> I'm using Camel 2.6 with servicemix 4.3 Fuse.
>
> I have the following config:
>
> #v+
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:pc="http://some.endpoint.com"
> xmlns:cxf="http://camel.apache.org/schema/cxf"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://camel.apache.org/schema/cxf
> http://camel.apache.org/schema/cxf/camel-cxf.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
> http://servicemix.apache.org/cxfse/1.0
> http://servicemix.apache.org/schema/servicemix-cxf-se-2009.01.xsd">
>
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
> <import resource="dao-context.xml"/>
>
> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
>
>
> <bean
> class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
> <property name="bus" ref="cxf" />
> <property name="camelContext" ref="camelContext" />
> <property name="checkException" value="true" />
> <property name="transportIds">
> <list>
> <value>http://cxf.apache.org/transports/camel</value>
> </list>
> </property>
> </bean>
>
> <jaxws:endpoint
> id="PCService"
> address="camel://direct:PCService"
> endpointName="default" serviceName="pc:PCService-1"
> implementor="pl.service.PCServiceImpl">
> <jaxws:features>
> <logging xmlns="http://cxf.apache.org/core" />
> </jaxws:features>
> </jaxws:endpoint>
>
> <camel:camelContext id="camelContext" trace="true"
> xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="jbi:service:http://some.endpoint.com/Endpoint-1/default" />
> <to uri="direct:PCService" />
> </route>
> </camel:camelContext>
>
>
> </beans>
> #v-
>
> Thanks in advance for any assistance.
>
> Marcin
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: cxf bean exposed via camel

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

My comment inline.
On 2011-8-1, at 下午9:11, Marcin Cylke wrote:

> Hi
>
> I'm trying to expose cxf service bean via cxf-camel transport.  
> Basically I want my bean to be accessible via JBI in Servicemix 4 -  
> some other services refer this service by jbi endpoints. Theses  
> services are also camel routers.
>
> Unfortunatelly the whole setup fails, the cxf bean never receives  
> the request.
>
> I'm using Camel 2.6 with servicemix 4.3 Fuse.
>
> I have the following config:
>
> #v+
> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:pc="http://some.endpoint.com"
>       xmlns:cxf="http://camel.apache.org/schema/cxf"
>       xmlns:camel="http://camel.apache.org/schema/spring"
>       xmlns:jaxws="http://cxf.apache.org/jaxws"
>       xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
>       xsi:schemaLocation="http://www.springframework.org/schema/ 
> beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>                           http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
>                           http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>                           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
>                           http://servicemix.apache.org/cxfse/1.0 http://servicemix.apache.org/schema/servicemix-cxf-se-2009.01.xsd 
> ">
>
>
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
>  <import resource="dao-context.xml"/>
>
>    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
>
>
>    <bean  
> class 
> ="org.apache.camel.component.cxf.transport.CamelTransportFactory">
>      <property name="bus" ref="cxf" />
>      <property name="camelContext" ref="camelContext" />
>      <property name="checkException" value="true" />
>      <property name="transportIds">
>        <list>
>          <value>http://cxf.apache.org/transports/camel</value>
>        </list>
>      </property>
>    </bean>
>
>    <jaxws:endpoint
>        id="PCService"
>        address="camel://direct:PCService"
>        endpointName="default" serviceName="pc:PCService-1"
>        implementor="pl.service.PCServiceImpl">
>        <jaxws:features>
>            <logging xmlns="http://cxf.apache.org/core" />
>        </jaxws:features>
>    </jaxws:endpoint>
>
>    <camel:camelContext id="camelContext" trace="true" xmlns="http://camel.apache.org/schema/spring 
> ">
>            <route>
>                <from uri="jbi:service:http://some.endpoint.com/Endpoint-1/default 
> " />
This <from uri="jbi:service:http://some.endpoint.com/Endpoint-1/ 
default" /> means expose a jbi endpoint on JBI bus, this endpoint is a  
JBI provider endpoint, it should be the target of some JBI consumer  
endpoint, from your configuration I can't see any JBI consumer  
endpoint, you're missing some JBI consumer endpoint such as cxf bc  
consumer which can handle external soap request and pass it to
<from uri="jbi:service:http://some.endpoint.com/Endpoint-1/default" />

Freeman
>                <to uri="direct:PCService" />
>            </route>
>    </camel:camelContext>
>
>
> </beans>
> #v-
>
> Thanks in advance for any assistance.
>
> Marcin

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com