Hi,

I'm trying to make a JBI Client to send messages to the wsdl-first Example that 
is shipped with the serviceMix 3.2.3.
This is what I have:

package pt.first.hdi.jbi;

import java.io.IOException;

import javax.jbi.JBIException;
import javax.jbi.messaging.InOut;
import javax.jbi.messaging.MessagingException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.apache.servicemix.client.*;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.xml.sax.SAXException;

public class Teste {

      /**
       * @param args
       */
      public static void main(String[] args) {
            // TODO Auto-generated method stub
            System.out.println("<-- Begin -->");
            ServiceMixClient client = getClient("tcp://localhost:61616");

            try {
                  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>world</msg:personId></msg:GetPerson>"
                    +  "  </jbi:part>"
                    +  "</jbi:message>"));

                  client.sendSync(me);

                  System.err.println(new 
SourceTransformer().contentToString(me.getOutMessage()));

            } catch (MessagingException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (TransformerException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (ParserConfigurationException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (SAXException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            }

            System.out.println("<--  End  -->");
      }

      public static ServiceMixClient getClient(String url) {

            RemoteServiceMixClient rsmx = new RemoteServiceMixClient(url);
            try {
                  rsmx.init();
                  rsmx.start();
            } catch (JBIException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            }

            return rsmx;
      }
}

But I'm getting this error:

javax.jbi.messaging.MessagingException: Could not find route for exchange: 
InOut[
  id: ID:192.168.20.128-12265298b3a-3: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>world</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:882)
      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 pt.first.hdi.jbi.Teste.main(Teste.java:41)


Can anyone tell me what I'm doing wrong?

Thanks,
Kintas

Reply via email to