Search in sources :

Example 6 with RemoteInvoker

use of org.switchyard.remote.RemoteInvoker in project quickstarts by jboss-switchyard.

the class JsonTransformationClient method main.

/**
     * Only execution point for this application.
     * @param ignored not used.
     * @throws Exception if something goes wrong.
     */
public static void main(final String[] ignored) throws Exception {
    // Create a new remote client invoker
    String port = System.getProperty("org.switchyard.component.sca.client.port", "8080");
    RemoteInvoker invoker = new HttpInvoker("http://localhost:" + port + "/switchyard-remote");
    // Create request payload
    Order order = new Order();
    order.setItemId("Turkey");
    order.setOrderId("Xmas Dinner");
    order.setQuantity(1);
    // Create the request message
    RemoteMessage message = new RemoteMessage();
    message.setService(SERVICE).setOperation("submitOrder").setContent(order);
    // Invoke the service
    RemoteMessage reply = invoker.invoke(message);
    if (reply.isFault()) {
        System.err.println("Oops ... something bad happened.  " + reply.getContent());
    } else {
        OrderAck orderAck = (OrderAck) reply.getContent();
        out.println("==================================");
        out.println("Was the offer accepted? " + orderAck.isAccepted());
        out.println("==================================");
    }
}
Also used : RemoteMessage(org.switchyard.remote.RemoteMessage) RemoteInvoker(org.switchyard.remote.RemoteInvoker) HttpInvoker(org.switchyard.remote.http.HttpInvoker)

Example 7 with RemoteInvoker

use of org.switchyard.remote.RemoteInvoker in project quickstarts by jboss-switchyard.

the class RulesCamelCBRClient method main.

/**
     * Only execution point for this application.
     * @param ignored not used.
     * @throws Exception if something goes wrong.
     */
public static void main(final String[] ignored) throws Exception {
    // Create a new remote client invoker
    String port = System.getProperty("org.switchyard.component.sca.client.port", "8080");
    RemoteInvoker invoker = new HttpInvoker("http://localhost:" + port + "/switchyard-remote");
    // Create request payload
    Box box = new Box(new Widget("FF0000-ABC-123"));
    // Create the request message
    RemoteMessage message = new RemoteMessage();
    message.setService(SERVICE).setOperation("processRoute").setContent(box);
    // Invoke the service
    invoker.invoke(message);
}
Also used : RemoteMessage(org.switchyard.remote.RemoteMessage) RemoteInvoker(org.switchyard.remote.RemoteInvoker) HttpInvoker(org.switchyard.remote.http.HttpInvoker)

Aggregations

RemoteInvoker (org.switchyard.remote.RemoteInvoker)7 RemoteMessage (org.switchyard.remote.RemoteMessage)7 HttpInvoker (org.switchyard.remote.http.HttpInvoker)7 Deal (org.switchyard.quickstarts.demo.txpropagation.Deal)1 Offer (org.switchyard.quickstarts.demo.txpropagation.Offer)1