Hi Nithya,

You should deploy both your service (as provider) and client proxy (as consumer) into same servicemix instance, unless you intend to use clustering. So you shouldn't create a jbi instance your self, if you just want to create ServiceMixClient instance, you can do per as below ServiceMixClient client = new ServiceMixClientFacade(context);// the context is ComponentContext, you can get it from any jbi component.

btw, you code
client.createDestination("service:http://localhost:8192/PersonService/";);
is not correct, you need specify the service name but not the service address

client.createDestination("service:http://servicemix.apache.org/samples/wsdl-first/PersonService";);

Best Regards

Freeman

nvijayak wrote:
It is the wsdl-first example that comes with servicemix. I created the jar
and copied it into hot-deploy.
The consumer-http-su xbean.xml is configured as below:

<beans xmlns:http="http://servicemix.apache.org/http/1.0";
xmlns:person="http://servicemix.apache.org/samples/wsdl-first";>
  <http:endpoint service="person:PersonService" endpoint="soap"
targetService="person:PersonService" role="consumer"
locationURI="http://0.0.0.0:8192/PersonService/";
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"; soap="true" /> </beans>

Thanks,
Nithya


Freeman Fang wrote:
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

Reply via email to