use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class CamelSaxonClient method main.
public static void main(String[] args) {
HTTPMixIn soapMixIn = new HTTPMixIn();
soapMixIn.initialize();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter your name: ");
String name = reader.readLine();
String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
soapMixIn.postString("http://localhost:" + port + "/quickstart-camel-saxon/GreetingService", request_prefix + name + request_suffix);
System.out.println("See the server console for output");
} catch (IOException ex) {
ex.printStackTrace();
} finally {
soapMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class WorkServiceMain method invokeWorkService.
private static void invokeWorkService(String scheme, int port, String context, Element assertion) throws Exception {
String soapRequest = new StringPuller().pull("/xml/soap-request.xml").replaceAll("WORK_CMD", "CMD-" + System.currentTimeMillis());
if (assertion != null) {
soapRequest = soapRequest.replaceFirst("<!-- Assertion -->", XMLHelper.toString(assertion));
}
HTTPMixIn http = new HTTPMixIn();
http.initialize();
try {
String endpoint = String.format("%s://localhost:%s/%s/WorkService", scheme, port, context);
//LOGGER.info(String.format("Invoking work service at endpoint: %s with request: %s", endpoint, soapRequest));
LOGGER.info(String.format("Invoking work service at endpoint: %s", endpoint));
String soapResponse = http.postString(endpoint, soapRequest);
//LOGGER.info(String.format("Received work service response: %s", soapResponse));
if (soapResponse.toLowerCase().contains("fault")) {
throw new Exception("Error invoking work service (check server log)");
}
} finally {
http.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class WorkServiceMain method invokeWorkService.
private static void invokeWorkService(String scheme, int port, String context, boolean signencrypt) throws Exception {
String soapRequest;
if (signencrypt) {
soapRequest = new StringPuller().pull("/xml/secure-request.xml");
} else {
soapRequest = new StringPuller().pull("/xml/insecure-request.xml").replaceAll("WORK_CMD", "CMD-" + System.currentTimeMillis());
}
HTTPMixIn http = new HTTPMixIn();
http.initialize();
try {
String endpoint = String.format("%s://localhost:%s/%s/WorkService", scheme, port, context);
//LOGGER.info(String.format("Invoking work service at endpoint: %s with request: %s", endpoint, soapRequest));
LOGGER.info(String.format("Invoking work service at endpoint: %s", endpoint));
String soapResponse = http.postString(endpoint, soapRequest);
//LOGGER.info(String.format("Received work service response: %s", soapResponse));
if (soapResponse.toLowerCase().contains("fault")) {
throw new Exception("Error invoking work service (check server log)");
}
} finally {
http.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class WorkServiceMain method invokeWorkService.
private static void invokeWorkService(String scheme, int port, String context, String username) throws Exception {
String soapRequest = new StringPuller().pull("/xml/soap-request.xml").replaceAll("WORK_CMD", "CMD-" + System.currentTimeMillis());
HTTPMixIn http = new HTTPMixIn();
soapRequest = soapRequest.replaceFirst("<!-- Username -->", username);
http.initialize();
try {
String endpoint = String.format("%s://localhost:%s/%s/WorkService", scheme, port, context);
//LOGGER.info(String.format("Invoking work service at endpoint: %s with request: %s", endpoint, soapRequest));
LOGGER.info(String.format("Invoking work service at endpoint: %s", endpoint));
String soapResponse = http.postString(endpoint, soapRequest);
//LOGGER.info(String.format("Received work service response: %s", soapResponse));
if (soapResponse.toLowerCase().contains("fault")) {
throw new Exception("Error invoking work service (check server log)");
}
} finally {
http.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class OrdersClient 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 {
HTTPMixIn soapMixIn = new HTTPMixIn();
soapMixIn.initialize();
try {
String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
String url = "http://localhost:" + port + "/demo-orders/OrderService";
String result = soapMixIn.postFile(url, XML);
System.out.println("SOAP Reply:\n" + result);
} finally {
soapMixIn.uninitialize();
}
}
Aggregations