You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jbgill <jb...@q.com> on 2010/03/18 21:31:00 UTC

Webapp (WAR file) invoking internal JBI endpoint

Hi everyone,

Here's a scenario I would like to perform if possible:  I have a cxfse
service unit which exports a JBI endpoint, and I have a WAR file webapp
containing servlets, both deployed into SMX 4 (latest snapshot build).

What I would like to do is internally call the JBI endpoint from the war
file's servlets over the NMR, without exposing it through a binding
component.  Ideally this would be through a CXF client proxy similar to what
you can do in a cxfse su with the <cxfse:proxy ... />  injection.

Is this possible?  If so, what are my options on how to do it?


-- 
View this message in context: http://old.nabble.com/Webapp-%28WAR-file%29-invoking-internal-JBI-endpoint-tp27950842p27950842.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Webapp (WAR file) invoking internal JBI endpoint

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

My comment inline
On 2010-3-19, at 上午4:31, jbgill wrote:

>
> Hi everyone,
>
> Here's a scenario I would like to perform if possible:  I have a cxfse
> service unit which exports a JBI endpoint, and I have a WAR file  
> webapp
> containing servlets, both deployed into SMX 4 (latest snapshot build).
>
> What I would like to do is internally call the JBI endpoint from the  
> war
> file's servlets over the NMR, without exposing it through a binding
> component.  Ideally this would be through a CXF client proxy similar  
> to what
> you can do in a cxfse su with the <cxfse:proxy ... />  injection.
>
> Is this possible?  If so, what are my options on how to do it?
No, I don't think you can simply use cxfse:proxy  injection directly   
from your servlet, as cxfse:proxy need  
org.apache.servicemix.jbi.runtime.ComponentRegistry implementation  
injection in osgi container, which is done through servicemix-cxf-se  
component.

But if your servlet spring configuration can also do  what we do for  
servicemix-cxf-se component configuration, you might take the benefit  
of using  proxy directly, you also need set correct JBI transport and  
bindings(jbi binding or soap binding depend on what the message  
payload you want), pretty much like what we do in  
CxfSeProxyFactoryBean, but honestly make all this work is not a easy  
job if you are not familiar with cxf and servicmix.

Or alternatively and  also more straightforward way is that  you can  
use nmr client api from your servlet, take a look at nmr example  
shipped with the kit,  the "client" part is more important for you.  
Some code like
	
             // Create the client channel
             client = nmr.createChannel(); //get the nmr through osgi  
service injection, for details from the spring configuration of nmr/ 
client bundle
             // Create a reference that will be used as the target for  
your exchanges
             Reference ref =  
nmr 
.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME,  
"your cxf se endpoint name"));

             // Create an exchange and send it
             Exchange e = client.createExchange(Pattern.InOut);
             e.setTarget(ref);
             e.getIn().setBody("soap message or jbi message depend on  
what you want");
             client.sendSync(e);

              e.setStatus(Status.Done);
              client.send(e);




You can use "nmr:list" command to get the nmr Endpoint.NAME for the  
cxf se endpoint you already deployed. You need take care of the  
message payload yourself.

Freeman

>
>
> -- 
> View this message in context: http://old.nabble.com/Webapp-%28WAR-file%29-invoking-internal-JBI-endpoint-tp27950842p27950842.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com