7.9. Test the Configuration of the Remote Client

Prerequisites

  • The server must have been started and the Hello World quick start must have been deployed

Procedure 7.5. Task

  • Run this test code:
        
    package org.jboss.esb.client;
    import
    import
    import
    import
    org.jboss.soa.esb.client.ServiceInvoker;
    org.jboss.soa.esb.listeners.message.MessageDeliverException;
    org.jboss.soa.esb.message.Message;
    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();
    }
    }
    }