7.10. Verify That a Remote Client's Configuration is Correct

Prerequisites

  • The JBoss Enterprise SOA Platform must be running and the HelloWorld quick start must be deployed.

Procedure 7.6. Task

  • Run this code:
    package org.jboss.esb.client;
    
    import org.jboss.soa.esb.client.ServiceInvoker;
    import org.jboss.soa.esb.listeners.message.MessageDeliverException;
    import org.jboss.soa.esb.message.Message;
    import org.jboss.soa.esb.message.format.MessageFactory;
    
    public class EsbClient
    {
        public static void main(String[] args)
        {
            System.setProperty("javax.xml.registry.ConnectionFactoryClass",
                    "org.apache.ws.scout.registry.ConnectionFactoryImpl");
            try
            {
                Message message = MessageFactory.getInstance().getMessage();
                message.getBody().add("Sample payload");
                ServiceInvoker invoker = new ServiceInvoker("FirstServiceESB", "SimpleListener");
                invoker.deliverAsync(message);
            }
            catch (final MessageDeliverException e)
            {
                e.printStackTrace();
            }