use of org.switchyard.remote.http.HttpInvoker in project quickstarts by jboss-switchyard.
the class CamelServiceClient 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 the request message
RemoteMessage message = new RemoteMessage();
message.setService(SERVICE).setOperation("acceptMessage").setContent(TEST_MESSAGE);
// Invoke the service
invoker.invoke(message);
}
use of org.switchyard.remote.http.HttpInvoker in project quickstarts by jboss-switchyard.
the class RemoteClient 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
Offer offer = createOffer(true);
// Create the request message
RemoteMessage message = new RemoteMessage();
message.setService(SERVICE).setOperation("offer").setContent(offer);
// Invoke the service
RemoteMessage reply = invoker.invoke(message);
if (reply.isFault()) {
System.err.println("Oops ... something bad happened. " + reply.getContent());
if (reply.getContent() instanceof Throwable) {
Throwable.class.cast(reply.getContent()).printStackTrace();
}
} else {
Deal deal = (Deal) reply.getContent();
out.println("==================================");
out.println("Was the offer accepted? " + deal.isAccepted());
out.println("==================================");
}
}
Aggregations