Hi Nithya,
Would you please append the configuration for your deployed service?
Best Regards
Freeman
nvijayak wrote:
Hi Freeman,
Thanks for following up. I have already started a servicemix instance and my
service is deployed there. I am trying to write a client that talks to that
service. Do I still need to register it?
Thanks,
Nithya
Freeman Fang wrote:
Hi Nithya,
This piece of code just create jbi client and send message to a service,
the problem is that I don't see where you register your service
(service: {http://localhost:8192/PersonService}) to the jbi. You should
create your service and register it to the jbi first.
Best Regards
Freeman
nvijayak wrote:
Hi,
I use the following code to create a client that invokes a service
JBIContainer container = new JBIContainer();
container.setUseMBeanServer(false);
container.setRmiPort(2999);
container.setCreateMBeanServer(false);
container.setEmbedded(true);
container.init();
container.start();
ServiceMixClient client = new DefaultServiceMixClient(container);
Destination destination =
client.createDestination("service:http://localhost:8192/PersonService/");
InOut me = destination.createInOutExchange();
me.getInMessage().setContent(new StringSource(
"<jbi:message
xmlns:jbi=\"http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper\""
+ "
xmlns:msg=\"http://servicemix.apache.org/samples/wsdl-first/types\" "
+ " name=\"Hello\" "
+ " type=\"msg:HelloRequest\" "
+ " version=\"1.0\">"
+ " <jbi:part>"
+ "
<msg:GetPerson><msg:personId>id</msg:personId></msg:GetPerson>"
+ " </jbi:part>"
+ "</jbi:message>"));
client.sendSync(me);
System.err.println(new
SourceTransformer().contentToString(me.getOutMessage()));
I get the following error when I run it:
Exception in thread "main" javax.jbi.messaging.MessagingException: Could
not
find route for exchange: InOut[
id: ID:128.107.102.246-117a3b0ca5f-2:0
status: Active
role: provider
service: {http://localhost:8192/PersonService}
in: <?xml version="1.0" encoding="UTF-8"?><jbi:message
xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"
xmlns:msg="http://servicemix.apache.org/samples/wsdl-first/types"
name="Hello" type="msg:HelloRequest" version="1.0"> <jbi:part>
<msg:GetPerson><msg:personId>id</msg:personId></msg:GetPerson>
</jbi:part></jbi:message>
] for service: {http://localhost:8192/PersonService} and interface: null
at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:470)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:442)
at
org.apache.servicemix.client.DefaultServiceMixClient.sendSync(DefaultServiceMixClient.java:155)
at
org.apache.servicemix.examples.CRSWSEndpointTest.main(CRSWSEndpointTest.java:92)
Thanks,
Nithya