Can I route OSGi calls in SMX4?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I route OSGi calls in SMX4?

Juan F. Valdés
I'm reviewing EIP osgi documentation and camel-osgi example and I have a doubt.

I want to develop one bundle that orchestrates request calling services from other bundles, and I would like to intercept those calls with camel, it is posible?

I think probably I will have to register an endpoint for my service in NMR, but, If I do so, have i to expose the service to remote calls? (with cxf or jms bc), I don't want that.

I saw there is a destination endpoint called log:ExampleRouter in camel-osgi example that references Commons logging Bundle. It seems that it is a kind of logical link between osgi and NMR endpoint and could be what I need for my application, ¿how can i do that for my bundles?

Thanks In Advance,

Juan.
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

gertv
Juan,

If you register an endpoint for your service in the NMR, you can access
it from you camel orchestration bundle.  The camel-nmr shows you how
different Camel routes can communicate over the NMR, but you can connect
anything there.  A service that has an endpoint registered on the NMR,
is not necessarily available for remote calls.

Whether or not you expose a service to remote calls, is entirely up to
you.  Many applications only expose a few (web)services to the outside
world, while working with a lot of different services for the
implementation.

For the log: endpoint, that actually refers to a Camel component
(http://activemq.apache.org/camel/log.html) which uses the
commons-logging API.  The only thing OSGi does here is provide the
classes from the logging bundle to the camel-core bundle.  If this is
what you want to, just take a look at any components in Camel for an
example.

Regards,

Gert

Juan F. Valdés wrote:

> I'm reviewing EIP osgi documentation and camel-osgi example and I have a
> doubt.
>
> I want to develop one bundle that orchestrates request calling services from
> other bundles, and I would like to intercept those calls with camel, it is
> posible?
>
> I think probably I will have to register an endpoint for my service in NMR,
> but, If I do so, have i to expose the service to remote calls? (with cxf or
> jms bc), I don't want that.
>
> I saw there is a destination endpoint called log:ExampleRouter in camel-osgi
> example that references Commons logging Bundle. It seems that it is a kind
> of logical link between osgi and NMR endpoint and could be what I need for
> my application, ¿how can i do that for my bundles?
>
> Thanks In Advance,
>
> Juan.
>  

Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

Juan F. Valdés
Hi Gert,

First of all, thank you so much for helping me. Now I have a better understanding of NMR.

Gert Vanthienen wrote
If you register an endpoint for your service in the NMR, you can access
it from you camel orchestration bundle.  The camel-nmr shows you how
different Camel routes can communicate over the NMR, but you can connect
anything there.  A service that has an endpoint registered on the NMR,
is not necessarily available for remote calls.
But, how can I register an endpoint for my OSGi service?

I mean, in camel-nmr example  "nmr:ExampleRouter" endpoint is implicitly created by NMR Component, but i need to link a NMR endpoint with my service, a simple HelloWorld OSGi service:

<osgi:service interface="com.santalucia.esb.primer.osgi.HolaMundoOSGi" >
                <bean id="holaMundoBean" class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">
                        <property name="mensaje"><value>Hola Mundo OSGi</value></property>
                </bean>
</osgi:service>

I could use EndpointExporter to expose the bundle as a JBI Service Unit, and use the JBI endpoint in the orchestration bundle through NMR, but I think there is a simpler way (without JBI) to do it, it is possible?

I had thought camel log component used the NMR-OSGi linking i was looking for but I realized it's a native Camel component

Cheers,

Juan

Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

Jean-Baptiste Onofré
In reply to this post by Juan F. Valdés
 Hi Juan,

 You can create a CXF like OSGi bundle using jxws:endpoint with a
address type nmr:MyService.

 With that, your OSGi bundle will be registered in the NMR and you
can use it from others components.

 Regards
 --
 Jean-Baptiste Onofré
 [hidden email]
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 14:59, Juan F. Valdés [hidden email]
wrote:

 Hi Gert,

 First of all, thank you so much for helping me. Now I have a better
 understanding of NMR.

 Gert Vanthienen wrote:
 >
 >
 > If you register an endpoint for your service in the NMR, you can
access
 > it from you camel orchestration bundle. The camel-nmr shows you
how
 > different Camel routes can communicate over the NMR, but you can
connect
 > anything there. A service that has an endpoint registered on the
NMR,
 > is not necessarily available for remote calls.
 >

 But, how can I register an endpoint for my OSGi service?

 I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
implicitly
 created by NMR Component, but i need to link a NMR endpoint with my
service,
 a simple HelloWorld OSGi service:

 class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">

        Hola Mundo OSGi

 I could use
 http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html
[1]
 EndpointExporter to expose the bundle as a JBI Service Unit, and use
the
 JBI endpoint in the orchestration bundle through NMR, but I think
there is a
 simpler way (without JBI) to do it, it is possible?

 I had thought camel log component used the NMR-OSGi linking i was
looking
 for but I realized it's a native Camel component

 Cheers,

 Juan

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
[2]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html
[2]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

Juan F. Valdés
Hi Jean-Baptiste,

Thank you for your response. I think if i create the endpoint on this way i would be exposing my OSGi service as JAX-WS Web Service, would't I?

I don't want that, and this is the reason for looking for a  solution where the creation of NMR endpoint was only "logical" (internal to the  bus). It's similar to the concept of JBI Service Engine without binding it to a BC, but I would like not to use JBI in my prototype.

Regards,

Juan.

Jean-Baptiste Onofré wrote
 Hi Juan,

 You can create a CXF like OSGi bundle using jxws:endpoint with a
address type nmr:MyService.

 With that, your OSGi bundle will be registered in the NMR and you
can use it from others components.

 Regards
 --
 Jean-Baptiste Onofré
 jb@nanthrax.net
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 14:59, Juan F. Valdés jfvaldes@atsistemas.com
wrote:

 Hi Gert,

 First of all, thank you so much for helping me. Now I have a better
 understanding of NMR.

 Gert Vanthienen wrote:
 >
 >
 > If you register an endpoint for your service in the NMR, you can
access
 > it from you camel orchestration bundle. The camel-nmr shows you
how
 > different Camel routes can communicate over the NMR, but you can
connect
 > anything there. A service that has an endpoint registered on the
NMR,
 > is not necessarily available for remote calls.
 >

 But, how can I register an endpoint for my OSGi service?

 I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
implicitly
 created by NMR Component, but i need to link a NMR endpoint with my
service,
 a simple HelloWorld OSGi service:

 class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">

        Hola Mundo OSGi

 I could use
 http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html
[1]
 EndpointExporter to expose the bundle as a JBI Service Unit, and use
the
 JBI endpoint in the orchestration bundle through NMR, but I think
there is a
 simpler way (without JBI) to do it, it is possible?

 I had thought camel log component used the NMR-OSGi linking i was
looking
 for but I realized it's a native Camel component

 Cheers,

 Juan

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
[2]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html
[2]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

Jean-Baptiste Onofré
In reply to this post by Juan F. Valdés
 Juan,

 No, you can register jaxws in the NMR.

 If you get a look on the SMX4 examples, you can see :

 - in the cxf-osgi exemple, the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [1]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[2]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="/HelloWorld"/>

 </beans>
 This beans.xml will deploy the jaxws endpoint directly on HTTP
(using the cxf-extension-http and cxf-extension-soap). We define HTTP
publishing using address="/HelloWorld" (the / at the beginning is
important).
 - on the other hand, in the cxf-nmr exemple (which a OSGi bundle
too), the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [3]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[4]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="nmr:HelloWorld" />

 </beans>
 Using this beans.xml (and the cxf-transport-nmr.xml), your OSGi
bundle will be registered directly in the NMR and will be available
for others BC components.

 One time your OSGi bundle is registered in the NMR, you can use it.
For exemple, in the deploy directory, you can create a test.xml file
looking like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:http="http://servicemix.apache.org/http/1.0"
 xmlns:fsb="urn:fsb"
 xmlns:osgi="http://www.springframework.org/schema/osgi"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans [5]
http://www.springframework.org/schema/beans/spring-beans.xsd [6]
 http://www.springframework.org/schema/osgi [7]
http://www.springframework.org/schema/osgi/spring-osgi.xsd [8]
 http://servicemix.apache.org/http/1.0 [9]
http://servicemix.apache.org/http/1.0/servicemix-http.xsd [10]">

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

 <http:endpoint service="fsb:AutomaticSimulation"
endpoint="AutomaticSimulationHTTP"
 role="consumer"
 locationUri="http://0.0.0.0:8192/HelloWorld"
 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
 soap="false"
 targetEndpoint="HelloWorld"/>

 </beans>

 FYI, currently, I make a set of samples with associated
documentation that (I hope) will be added to the SMX4 tutorial.

 Regards
 JB
 --
 Jean-Baptiste Onofré
 [hidden email]
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 16:35, Juan F. Valdés [hidden email]
wrote:

 Hi Jean-Baptiste,

 Thank you for your response. I think if i create the endpoint on
this way i
 would be exposing my OSGi service as JAX-WS Web Service, would't I?

 I don't want that, and this is the reason for looking for a solution
where
 the creation of NMR endpoint was only "logical" (internal to the
bus). It's
 similar to the concept of JBI Service Engine without binding it to a
BC, but
 I would like not to use JBI in my prototype.

 Regards,

 Juan.

 Jean-Baptiste Onofré wrote:
 >
 > Hi Juan,
 >
 > You can create a CXF like OSGi bundle using jxws:endpoint with a
 > address type nmr:MyService.
 >
 > With that, your OSGi bundle will be registered in the NMR and you
 > can use it from others components.
 >
 > Regards
 > --
 > Jean-Baptiste Onofré
 > [hidden email] [11]
 > BuildProcess/AutoDeploy Project Leader
 > http://buildprocess.sourceforge.net  [12]>
 >
 > On Mon 03/11/08 14:59, Juan F. Valdés [hidden email]
[13]
 > wrote:
 >
 > Hi Gert,
 >
 > First of all, thank you so much for helping me. Now I have a
better
 > understanding of NMR.
 >
 > Gert Vanthienen wrote:
 > >
 > >
 > > If you register an endpoint for your service in the NMR, you can

 > access
 > > it from you camel orchestration bundle. The camel-nmr shows you
 > how
 > > different Camel routes can communicate over the NMR, but you can

 > connect
 > > anything there. A service that has an endpoint registered on the

 > NMR,
 > > is not necessarily available for remote calls.
 > >
 >
 > But, how can I register an endpoint for my OSGi service?
 >
 > I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
 > implicitly
 > created by NMR Component, but i need to link a NMR endpoint with
my
 > service,
 > a simple HelloWorld OSGi service:
 >
 > class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">
 >
 > Hola Mundo OSGi
 >
 > I could use
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[14]>
 > [1]
 > EndpointExporter to expose the bundle as a JBI Service Unit, and
use
 > the
 > JBI endpoint in the orchestration bundle through NMR, but I think
 > there is a
 > simpler way (without JBI) to do it, it is possible?
 >
 > I had thought camel log component used the NMR-OSGi linking i was
 > looking
 > for but I realized it's a native Camel component
 >
 > Cheers,
 >
 > Juan
 >
 > --
 > View this message in context:
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [15]>
 > [2]
 > Sent from the ServiceMix - User mailing list archive at
Nabble.com.
 >
 >
 >
 > Links:
 > ------
 > [1]
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[16]>
 > [2]
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [17]>
 >
 >

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html
[18]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1] http://www.springframework.org/schema/beans/spring-beans.xsd
[2] http://cxf.apache.org/schemas/jaxws.xsd
[3] http://www.springframework.org/schema/beans/spring-beans.xsd
[4] http://cxf.apache.org/schemas/jaxws.xsd
[5] http://www.springframework.org/schema/beans
[6] http://www.springframework.org/schema/beans/spring-beans.xsd
[7] http://www.springframework.org/schema/osgi
[8] http://www.springframework.org/schema/osgi/spring-osgi.xsd
[9] http://servicemix.apache.org/http/1.0
[10] http://servicemix.apache.org/http/1.0/servicemix-http.xsd
[11] mailto:[hidden email]
[12] http://buildprocess.sourceforge.net</font
[13] mailto:[hidden email]
[14]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[15]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[16]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[17]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[18]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

Juan F. Valdés
Hi,

jaxws tag was the feature I was looking for!

However the subject of my question was wrong because my misunderstanding of platform, I got confused by OSGi-NMR relation.

Can I route OSGi calls in SMX4 with camel? No, I can't, OSGi service calls are JVM native calls (I coud use other solutions like Spring and AspectJ), but I can easilly expose my OSGi services as NMR endpoints using cxf-transport-nmr to convert "Java" parameters to Normalized Messages and then using Camel to route intra-bus NMR calls, which is camel-nmr proposal.

Thanks for your help, I hope seeing your examples in SMX4 tutorial.

Regards,

Juan


<quote author="Jean-Baptiste Onofré">
 Juan,

 No, you can register jaxws in the NMR.

 If you get a look on the SMX4 examples, you can see :

 - in the cxf-osgi exemple, the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [1]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[2]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="/HelloWorld"/>

 </beans>
 This beans.xml will deploy the jaxws endpoint directly on HTTP
(using the cxf-extension-http and cxf-extension-soap). We define HTTP
publishing using address="/HelloWorld" (the / at the beginning is
important).
 - on the other hand, in the cxf-nmr exemple (which a OSGi bundle
too), the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [3]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[4]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="nmr:HelloWorld" />

 </beans>
 Using this beans.xml (and the cxf-transport-nmr.xml), your OSGi
bundle will be registered directly in the NMR and will be available
for others BC components.

 One time your OSGi bundle is registered in the NMR, you can use it.
For exemple, in the deploy directory, you can create a test.xml file
looking like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:http="http://servicemix.apache.org/http/1.0"
 xmlns:fsb="urn:fsb"
 xmlns:osgi="http://www.springframework.org/schema/osgi"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans [5]
http://www.springframework.org/schema/beans/spring-beans.xsd [6]
 http://www.springframework.org/schema/osgi [7]
http://www.springframework.org/schema/osgi/spring-osgi.xsd [8]
 http://servicemix.apache.org/http/1.0 [9]
http://servicemix.apache.org/http/1.0/servicemix-http.xsd [10]">

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

 <http:endpoint service="fsb:AutomaticSimulation"
endpoint="AutomaticSimulationHTTP"
 role="consumer"
 locationUri="http://0.0.0.0:8192/HelloWorld"
 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
 soap="false"
 targetEndpoint="HelloWorld"/>

 </beans>

 FYI, currently, I make a set of samples with associated
documentation that (I hope) will be added to the SMX4 tutorial.

 Regards
 JB
 --
 Jean-Baptiste Onofré
 jb@nanthrax.net
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 16:35, Juan F. Valdés jfvaldes@atsistemas.com
wrote:

 Hi Jean-Baptiste,

 Thank you for your response. I think if i create the endpoint on
this way i
 would be exposing my OSGi service as JAX-WS Web Service, would't I?

 I don't want that, and this is the reason for looking for a solution
where
 the creation of NMR endpoint was only "logical" (internal to the
bus). It's
 similar to the concept of JBI Service Engine without binding it to a
BC, but
 I would like not to use JBI in my prototype.

 Regards,

 Juan.

 Jean-Baptiste Onofré wrote:
 >
 > Hi Juan,
 >
 > You can create a CXF like OSGi bundle using jxws:endpoint with a
 > address type nmr:MyService.
 >
 > With that, your OSGi bundle will be registered in the NMR and you
 > can use it from others components.
 >
 > Regards
 > --
 > Jean-Baptiste Onofré
 > jb@nanthrax.net [11]
 > BuildProcess/AutoDeploy Project Leader
 > http://buildprocess.sourceforge.net  [12]>
 >
 > On Mon 03/11/08 14:59, Juan F. Valdés jfvaldes@atsistemas.com
[13]
 > wrote:
 >
 > Hi Gert,
 >
 > First of all, thank you so much for helping me. Now I have a
better
 > understanding of NMR.
 >
 > Gert Vanthienen wrote:
 > >
 > >
 > > If you register an endpoint for your service in the NMR, you can

 > access
 > > it from you camel orchestration bundle. The camel-nmr shows you
 > how
 > > different Camel routes can communicate over the NMR, but you can

 > connect
 > > anything there. A service that has an endpoint registered on the

 > NMR,
 > > is not necessarily available for remote calls.
 > >
 >
 > But, how can I register an endpoint for my OSGi service?
 >
 > I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
 > implicitly
 > created by NMR Component, but i need to link a NMR endpoint with
my
 > service,
 > a simple HelloWorld OSGi service:
 >
 > class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">
 >
 > Hola Mundo OSGi
 >
 > I could use
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[14]>
 > [1]
 > EndpointExporter to expose the bundle as a JBI Service Unit, and
use
 > the
 > JBI endpoint in the orchestration bundle through NMR, but I think
 > there is a
 > simpler way (without JBI) to do it, it is possible?
 >
 > I had thought camel log component used the NMR-OSGi linking i was
 > looking
 > for but I realized it's a native Camel component
 >
 > Cheers,
 >
 > Juan
 >
 > --
 > View this message in context:
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [15]>
 > [2]
 > Sent from the ServiceMix - User mailing list archive at
Nabble.com.
 >
 >
 >
 > Links:
 > ------
 > [1]
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[16]>
 > [2]
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [17]>
 >
 >

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html
[18]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1] http://www.springframework.org/schema/beans/spring-beans.xsd
[2] http://cxf.apache.org/schemas/jaxws.xsd
[3] http://www.springframework.org/schema/beans/spring-beans.xsd
[4] http://cxf.apache.org/schemas/jaxws.xsd
[5] http://www.springframework.org/schema/beans
[6] http://www.springframework.org/schema/beans/spring-beans.xsd
[7] http://www.springframework.org/schema/osgi
[8] http://www.springframework.org/schema/osgi/spring-osgi.xsd
[9] http://servicemix.apache.org/http/1.0
[10] http://servicemix.apache.org/http/1.0/servicemix-http.xsd
[11] mailto:jb@nanthrax.net
[12] http://buildprocess.sourceforge.net</font
[13] mailto:jfvaldes@atsistemas.com
[14]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[15]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[16]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[17]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[18]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html

</quote>
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

rotgier
In reply to this post by Jean-Baptiste Onofré

<quote author="jb-58">
 Juan,

 No, you can register jaxws in the NMR.

 If you get a look on the SMX4 examples, you can see :

 - in the cxf-osgi exemple, the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [1]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[2]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="/HelloWorld"/>

 </beans>
 This beans.xml will deploy the jaxws endpoint directly on HTTP
(using the cxf-extension-http and cxf-extension-soap). We define HTTP
publishing using address="/HelloWorld" (the / at the beginning is
important).
 - on the other hand, in the cxf-nmr exemple (which a OSGi bundle
too), the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [3]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[4]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="nmr:HelloWorld" />

 </beans>
 Using this beans.xml (and the cxf-transport-nmr.xml), your OSGi
bundle will be registered directly in the NMR and will be available
for others BC components.

 One time your OSGi bundle is registered in the NMR, you can use it.
For exemple, in the deploy directory, you can create a test.xml file
looking like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:http="http://servicemix.apache.org/http/1.0"
 xmlns:fsb="urn:fsb"
 xmlns:osgi="http://www.springframework.org/schema/osgi"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans [5]
http://www.springframework.org/schema/beans/spring-beans.xsd [6]
 http://www.springframework.org/schema/osgi [7]
http://www.springframework.org/schema/osgi/spring-osgi.xsd [8]
 http://servicemix.apache.org/http/1.0 [9]
http://servicemix.apache.org/http/1.0/servicemix-http.xsd [10]">

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

 <http:endpoint service="fsb:AutomaticSimulation"
endpoint="AutomaticSimulationHTTP"
 role="consumer"
 locationUri="http://0.0.0.0:8192/HelloWorld"
 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
 soap="false"
 targetEndpoint="HelloWorld"/>

 </beans>

 FYI, currently, I make a set of samples with associated
documentation that (I hope) will be added to the SMX4 tutorial.

 Regards
 JB
 --
 Jean-Baptiste Onofré
 jb@nanthrax.net
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 16:35, Juan F. Valdés jfvaldes@atsistemas.com
wrote:

 Hi Jean-Baptiste,

 Thank you for your response. I think if i create the endpoint on
this way i
 would be exposing my OSGi service as JAX-WS Web Service, would't I?

 I don't want that, and this is the reason for looking for a solution
where
 the creation of NMR endpoint was only "logical" (internal to the
bus). It's
 similar to the concept of JBI Service Engine without binding it to a
BC, but
 I would like not to use JBI in my prototype.

 Regards,

 Juan.

 Jean-Baptiste Onofré wrote:
 >
 > Hi Juan,
 >
 > You can create a CXF like OSGi bundle using jxws:endpoint with a
 > address type nmr:MyService.
 >
 > With that, your OSGi bundle will be registered in the NMR and you
 > can use it from others components.
 >
 > Regards
 > --
 > Jean-Baptiste Onofré
 > jb@nanthrax.net [11]
 > BuildProcess/AutoDeploy Project Leader
 > http://buildprocess.sourceforge.net  [12]>
 >
 > On Mon 03/11/08 14:59, Juan F. Valdés jfvaldes@atsistemas.com
[13]
 > wrote:
 >
 > Hi Gert,
 >
 > First of all, thank you so much for helping me. Now I have a
better
 > understanding of NMR.
 >
 > Gert Vanthienen wrote:
 > >
 > >
 > > If you register an endpoint for your service in the NMR, you can

 > access
 > > it from you camel orchestration bundle. The camel-nmr shows you
 > how
 > > different Camel routes can communicate over the NMR, but you can

 > connect
 > > anything there. A service that has an endpoint registered on the

 > NMR,
 > > is not necessarily available for remote calls.
 > >
 >
 > But, how can I register an endpoint for my OSGi service?
 >
 > I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
 > implicitly
 > created by NMR Component, but i need to link a NMR endpoint with
my
 > service,
 > a simple HelloWorld OSGi service:
 >
 > class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">
 >
 > Hola Mundo OSGi
 >
 > I could use
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[14]>
 > [1]
 > EndpointExporter to expose the bundle as a JBI Service Unit, and
use
 > the
 > JBI endpoint in the orchestration bundle through NMR, but I think
 > there is a
 > simpler way (without JBI) to do it, it is possible?
 >
 > I had thought camel log component used the NMR-OSGi linking i was
 > looking
 > for but I realized it's a native Camel component
 >
 > Cheers,
 >
 > Juan
 >
 > --
 > View this message in context:
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [15]>
 > [2]
 > Sent from the ServiceMix - User mailing list archive at
Nabble.com.
 >
 >
 >
 > Links:
 > ------
 > [1]
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[16]>
 > [2]
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [17]>
 >
 >

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html
[18]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1] http://www.springframework.org/schema/beans/spring-beans.xsd
[2] http://cxf.apache.org/schemas/jaxws.xsd
[3] http://www.springframework.org/schema/beans/spring-beans.xsd
[4] http://cxf.apache.org/schemas/jaxws.xsd
[5] http://www.springframework.org/schema/beans
[6] http://www.springframework.org/schema/beans/spring-beans.xsd
[7] http://www.springframework.org/schema/osgi
[8] http://www.springframework.org/schema/osgi/spring-osgi.xsd
[9] http://servicemix.apache.org/http/1.0
[10] http://servicemix.apache.org/http/1.0/servicemix-http.xsd
[11] mailto:jb@nanthrax.net
[12] http://buildprocess.sourceforge.net</font
[13] mailto:jfvaldes@atsistemas.com
[14]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[15]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[16]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[17]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[18]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html

</quote>
Reply | Threaded
Open this post in threaded view
|

Re: Can I route OSGi calls in SMX4?

rotgier
In reply to this post by Jean-Baptiste Onofré
Hello Jean-Baptiste,

Sorry for previous blank post.

I use FUSE-4.0.0.4 and I try to route JBI calls into CXF (the OSGI version of CXF). I therefore follow the advice in your post and use the cxf-nmr example to expose the jaxws in nmr. I have modified the beans.xml of cxf-nmr example in following way:

<jaxws:endpoint id="helloWorld" endpointName="osgitonmr:helloendpoint"
        serviceName="osgitonmr:HelloWorld" xmlns:osgitonmr="http://agh.soa.edu.pl/osgitonmr"
        implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
        address="nmr:{http://agh.soa.edu.pl/osgitonmr}HelloWorld:helloendpoint?mep=in-out" />

I have also deployed proper HTTP endpoint in JBI, by means of direct XML deployment:

<http:endpoint service="AutomaticSimulation" endpoint="AutomaticSimulationHTTP"
        role="consumer" locationURI="http://0.0.0.0:8192/HelloWorld"
        defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true"
        targetService="osgitonmr:HelloWorld" targetEndpoint="osgitonmr:helloendpoint" />

Everything seem to be fine but I am not sure about the structure of XML file that should be sent to "http://0.0.0.0:8192/HelloWorld". I have tried to do it in two ways but both failed.

1.
XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cxf="http://cxf.examples.servicemix.apache.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <cxf:sayHi>
         <arg0>Hi</arg0>
      </cxf:sayHi>
   </soapenv:Body>
</soapenv:Envelope>
Error in Logfile: first_exception.txt

2.
XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cxf="http://cxf.examples.servicemix.apache.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <soapenv:sayHi>
         <cxf:arg0>Hi</cxf:arg0>
      </soapenv:sayHi>
   </soapenv:Body>
</soapenv:Envelope>
Error in Logfile: second_exception.txt


I have also tried to set the soap attribute of HTTP JBI endpoint to false (of course in this case I sent the XML without the SOAP enveloper), but the exceptions were the same.

What can be the reason of this problems?

How should the input XML look like ?



Thanks in advance.

Kind Regards,

Marek Psiuk

<quote author="jb-58">
 Juan,

 No, you can register jaxws in the NMR.

 If you get a look on the SMX4 examples, you can see :

 - in the cxf-osgi exemple, the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [1]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[2]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="/HelloWorld"/>

 </beans>
 This beans.xml will deploy the jaxws endpoint directly on HTTP
(using the cxf-extension-http and cxf-extension-soap). We define HTTP
publishing using address="/HelloWorld" (the / at the beginning is
important).
 - on the other hand, in the cxf-nmr exemple (which a OSGi bundle
too), the beans.xml looks like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd [3]
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
[4]">

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

 <jaxws:endpoint id="helloWorld"
 implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
 address="nmr:HelloWorld" />

 </beans>
 Using this beans.xml (and the cxf-transport-nmr.xml), your OSGi
bundle will be registered directly in the NMR and will be available
for others BC components.

 One time your OSGi bundle is registered in the NMR, you can use it.
For exemple, in the deploy directory, you can create a test.xml file
looking like this :
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:http="http://servicemix.apache.org/http/1.0"
 xmlns:fsb="urn:fsb"
 xmlns:osgi="http://www.springframework.org/schema/osgi"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://www.springframework.org/schema/beans [5]
http://www.springframework.org/schema/beans/spring-beans.xsd [6]
 http://www.springframework.org/schema/osgi [7]
http://www.springframework.org/schema/osgi/spring-osgi.xsd [8]
 http://servicemix.apache.org/http/1.0 [9]
http://servicemix.apache.org/http/1.0/servicemix-http.xsd [10]">

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

 <http:endpoint service="fsb:AutomaticSimulation"
endpoint="AutomaticSimulationHTTP"
 role="consumer"
 locationUri="http://0.0.0.0:8192/HelloWorld"
 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
 soap="false"
 targetEndpoint="HelloWorld"/>

 </beans>

 FYI, currently, I make a set of samples with associated
documentation that (I hope) will be added to the SMX4 tutorial.

 Regards
 JB
 --
 Jean-Baptiste Onofré
 jb@nanthrax.net
 BuildProcess/AutoDeploy Project Leader
 http://buildprocess.sourceforge.net

 On Mon 03/11/08 16:35, Juan F. Valdés jfvaldes@atsistemas.com
wrote:

 Hi Jean-Baptiste,

 Thank you for your response. I think if i create the endpoint on
this way i
 would be exposing my OSGi service as JAX-WS Web Service, would't I?

 I don't want that, and this is the reason for looking for a solution
where
 the creation of NMR endpoint was only "logical" (internal to the
bus). It's
 similar to the concept of JBI Service Engine without binding it to a
BC, but
 I would like not to use JBI in my prototype.

 Regards,

 Juan.

 Jean-Baptiste Onofré wrote:
 >
 > Hi Juan,
 >
 > You can create a CXF like OSGi bundle using jxws:endpoint with a
 > address type nmr:MyService.
 >
 > With that, your OSGi bundle will be registered in the NMR and you
 > can use it from others components.
 >
 > Regards
 > --
 > Jean-Baptiste Onofré
 > jb@nanthrax.net [11]
 > BuildProcess/AutoDeploy Project Leader
 > http://buildprocess.sourceforge.net  [12]>
 >
 > On Mon 03/11/08 14:59, Juan F. Valdés jfvaldes@atsistemas.com
[13]
 > wrote:
 >
 > Hi Gert,
 >
 > First of all, thank you so much for helping me. Now I have a
better
 > understanding of NMR.
 >
 > Gert Vanthienen wrote:
 > >
 > >
 > > If you register an endpoint for your service in the NMR, you can

 > access
 > > it from you camel orchestration bundle. The camel-nmr shows you
 > how
 > > different Camel routes can communicate over the NMR, but you can

 > connect
 > > anything there. A service that has an endpoint registered on the

 > NMR,
 > > is not necessarily available for remote calls.
 > >
 >
 > But, how can I register an endpoint for my OSGi service?
 >
 > I mean, in camel-nmr example "nmr:ExampleRouter" endpoint is
 > implicitly
 > created by NMR Component, but i need to link a NMR endpoint with
my
 > service,
 > a simple HelloWorld OSGi service:
 >
 > class="com.santalucia.esb.primer.osgi.HolaMundoOSGiImpl">
 >
 > Hola Mundo OSGi
 >
 > I could use
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[14]>
 > [1]
 > EndpointExporter to expose the bundle as a JBI Service Unit, and
use
 > the
 > JBI endpoint in the orchestration bundle through NMR, but I think
 > there is a
 > simpler way (without JBI) to do it, it is possible?
 >
 > I had thought camel log component used the NMR-OSGi linking i was
 > looking
 > for but I realized it's a native Camel component
 >
 > Cheers,
 >
 > Juan
 >
 > --
 > View this message in context:
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [15]>
 > [2]
 > Sent from the ServiceMix - User mailing list archive at
Nabble.com.
 >
 >
 >
 > Links:
 > ------
 > [1]
 >
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html 
[16]>
 > [2]
 >
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html
 [17]>
 >
 >

 --
 View this message in context:
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html
[18]
 Sent from the ServiceMix - User mailing list archive at Nabble.com.



Links:
------
[1] http://www.springframework.org/schema/beans/spring-beans.xsd
[2] http://cxf.apache.org/schemas/jaxws.xsd
[3] http://www.springframework.org/schema/beans/spring-beans.xsd
[4] http://cxf.apache.org/schemas/jaxws.xsd
[5] http://www.springframework.org/schema/beans
[6] http://www.springframework.org/schema/beans/spring-beans.xsd
[7] http://www.springframework.org/schema/osgi
[8] http://www.springframework.org/schema/osgi/spring-osgi.xsd
[9] http://servicemix.apache.org/http/1.0
[10] http://servicemix.apache.org/http/1.0/servicemix-http.xsd
[11] mailto:jb@nanthrax.net
[12] http://buildprocess.sourceforge.net</font
[13] mailto:jfvaldes@atsistemas.com
[14]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[15]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[16]
http://fusesource.com/docs/esb/4.0/fsf_se/ESBFSFSEDeployService.html</font
[17]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20303228.html</font
[18]
http://www.nabble.com/Can-I-route-OSGi-calls-in-SMX4--tp20262134p20304896.html

</quote>
first_exception.txtsecond_exception.txtsecond_exception.txt