The jsr181 component works the same way as other component.
The point is that the jsr181:endpoint does not define a component, but an
endpoint inside a component.
You have to use something like the following (inside the <sm:container/>
tag)
<sm:activationSpec>
<sm:component>
<jsr181:component>
<jsr181:endpoints>
<jsr181:endpoint .... />
</>
</>
</>
else, this is just a spring bean without any relationship with the jbi
container.
Cheers,
Guillaume Nodet
On 5/29/06, MikeGeorge <[EMAIL PROTECTED]> wrote:
My servicemix.xml goes like:
---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:eip="http://servicemix.apache.org/eip/1.0"
xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
xmlns:my="http://servicemix.apache.org/demo/">
<sm:container id="jbi" useMBeanServer="true"
createMBeanServer="true" dumpStats="true" statsInterval="10">
<sm:activationSpecs>
<sm:activationSpec componentName="httpReceiver"
service="my:httpBinding"
endpoint="httpReceiver"
destinationService="my:ejbWsifHttpBridge">
<sm:component>
<bean
class="org.apache.servicemix.components.http.HttpConnector">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="ejbWsifHttpBridge"
service="my:ejbWsifHttpBridge">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="EjbWsifHttpBridge" >
<property name="name">
<value>1</value>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
<jsr181:endpoint annotations="none" service="my:jsrWsifEjbBC"
endpoint="jsrWsifEjbBC">
<jsr181:pojo>
<bean
class="
org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean
">
<property name="jndiName"
value="esb-statelessSession-TraderHome"/>
<property name="businessInterface"
value="examples.webservices.basic.statelessSession.HelloWorldBI"/>
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
</bean>
</jsr181:pojo>
</jsr181:endpoint>
<!-- bean
Other code goes here
</bean -->
</beans>
My EjbWsifHttpBridge.java goes like:
-------------------------------------------------
public class EjbWsifHttpBridge extends TransformComponentSupport
implements
MessageExchangeListener{
private String name;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
protected boolean transform(MessageExchange exchange,
NormalizedMessage in,
NormalizedMessage out) throws MessagingException {
System.out.println("EjbWsifHttpBridge(" + name +
").onMessageExchange...01. exchange.getService() = " +
exchange.getService());
QName qName = new QName("
http://servicemix.apache.org/demo/",
"jsrWsifEjbBC");
InOut inOut = createInOutExchange(qName, null, null);
NormalizedMessage normalizedMessageIn =
inOut.createMessage();
//normalizedMessageIn.setProperty("intVal", new
Integer(1));
//normalizedMessageIn.setProperty("string", "a");
inOut.setInMessage(normalizedMessageIn);
System.out.println("EjbWsifHttpBridge(" + name +
").onMessageExchange.
02");
sendSync(inOut);
System.out.println("EjbWsifHttpBridge(" + name +
").onMessageExchange.
03");
NormalizedMessage normalizedMessageOut =
inOut.getOutMessage();
//String result = (String)
normalizedMessageOut.getProperty("result");
//System.out.println("EjbWsifHttpBridge(" + name +
").result = " +
result);
out.setContent(new
StringSource("<Test><Element1/><Element2/></Test>"));
System.out.println("EjbWsifHttpBridge(" + name +
").onMessageExchange.
End");
return true;
}
}
When I tried to send message through my HTTP Client, I am getting
following
error:
---------------------------------------------------------------------------------------------------------------------
Apache ServiceMix ESB: 3.0-SNAPSHOT
Loading Apache ServiceMix from file: servicemix.xml
INFO - ComponentMBeanImpl.init(184) | Initializing component:
#SubscriptionManager#
INFO - DeploymentService.buildState(683) | Restoring service assemblies
INFO - JBIContainer.init(519) | ServiceMix JBI Container
(http://servicemix.org/) name: ServiceMix r
unning version: 3.0-SNAPSHOT
INFO - ComponentMBeanImpl.init(184) | Initializing component: httpReceiver
INFO - JCLLoggerAdapter.info(216) | Logging to
[EMAIL PROTECTED] via org.mortb
ay.log.Slf4jLog
INFO - ComponentMBeanImpl.init(184) | Initializing component:
ejbWsifHttpBridge
INFO - JCLLoggerAdapter.info(216) | Started SocketConnector @
localhost:8912
INFO - JCLLoggerAdapter.info(216) | jbiServlet: init
EjbWsifHttpBridge(1).onMessageExchange...01. exchange.getService() =
{http://servicemix.apache.org/d
emo/}ejbWsifHttpBridge
EjbWsifHttpBridge(1).onMessageExchange. 02
WARN - Broker.resolveAddress(355) | ServiceName
({http://servicemix.apache.org/demo/}jsrWsifEjbBC) s
pecified for routing, but can't find it registered
WARN - JCLLoggerAdapter.warn(346) | /:
javax.jbi.messaging.MessagingException: Could not find route for exchange:
org.apache.servicemix.jbi
[EMAIL PROTECTED] for service:
{http://servicemix.apache.org/demo/}jsrWsifEjbBC and inter
face: null
at
org.apache.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:309)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(
JBIContainer.java:694)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
DeliveryChannelImpl.java:4
50)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:524)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:501)
at
org.apache.servicemix.components.util.PojoSupport.sendSync(
PojoSupport.java:226)
at EjbWsifHttpBridge.transform(EjbWsifHttpBridge.java:49)
at
org.apache.servicemix.components.util.TransformComponentSupport.onMessageExchange
(Transfo
rmComponentSupport.java:48)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound
(DeliveryChannelImp
l.java:636)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
AbstractFlow.java:171)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:157)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java
:121)
at
org.apache.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:295)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(
JBIContainer.java:694)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
DeliveryChannelImpl.java:4
50)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:524)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:501)
at
org.apache.servicemix.components.http.HttpInOutBinding.processInOut(
HttpInOutBinding.java
:59)
at
org.apache.servicemix.components.http.HttpInOutBinding.process(
HttpInOutBinding.java:44)
at
org.apache.servicemix.components.http.BindingServlet.doPost(
BindingServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:423)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:350)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:536)
at org.mortbay.jetty.Server.handle(Server.java:309)
at org.mortbay.jetty.Server.handle(Server.java:285)
at
org.mortbay.jetty.HttpConnection.doHandler(HttpConnection.java:364)
at
org.mortbay.jetty.HttpConnection.access$1600(HttpConnection.java:46)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(
HttpConnection.java:629)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:608)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java
:194)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java
:298)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java
:153)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java
:412)
WARN - JCLLoggerAdapter.warn(346) | /
javax.jbi.messaging.MessagingException: Could not find route for exchange:
org.apache.servicemix.jbi
[EMAIL PROTECTED] for service:
{http://servicemix.apache.org/demo/}jsrWsifEjbBC and inter
face: null
at
org.apache.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:309)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(
JBIContainer.java:694)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
DeliveryChannelImpl.java:4
50)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:524)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:501)
at
org.apache.servicemix.components.util.PojoSupport.sendSync(
PojoSupport.java:226)
at EjbWsifHttpBridge.transform(EjbWsifHttpBridge.java:49)
at
org.apache.servicemix.components.util.TransformComponentSupport.onMessageExchange
(Transfo
rmComponentSupport.java:48)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound
(DeliveryChannelImp
l.java:636)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
AbstractFlow.java:171)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:157)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java
:121)
at
org.apache.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:295)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(
JBIContainer.java:694)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
DeliveryChannelImpl.java:4
50)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:524)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(
DeliveryChannelImpl.java
:501)
at
org.apache.servicemix.components.http.HttpInOutBinding.processInOut(
HttpInOutBinding.java
:59)
at
org.apache.servicemix.components.http.HttpInOutBinding.process(
HttpInOutBinding.java:44)
at
org.apache.servicemix.components.http.BindingServlet.doPost(
BindingServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:423)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:350)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:536)
at org.mortbay.jetty.Server.handle(Server.java:309)
at org.mortbay.jetty.Server.handle(Server.java:285)
at
org.mortbay.jetty.HttpConnection.doHandler(HttpConnection.java:364)
at
org.mortbay.jetty.HttpConnection.access$1600(HttpConnection.java:46)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(
HttpConnection.java:629)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:608)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java
:194)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java
:298)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java
:153)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java
:412)
I have seen
ServiceMix\incubator-
servicemix-3.0-SNAPSHOT_2006-05-06\examples\soap-binding
example, BUT I WOULD LIKE TO invoke the jsr181:endpoint similar to what
I've
been trying here. Any hint on how to do this?
Thanks -- Mike.
--
View this message in context:
http://www.nabble.com/How+to+invoke+jsr181%3Aendpoint-EJB-t1699908.html#a4613063
Sent from the ServiceMix - User forum at Nabble.com.
--
Cheers,
Guillaume Nodet