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 binarySecurityToken) throws Exception {
String soapRequest = new StringPuller().pull("/xml/soap-request.xml").replaceAll("WORK_CMD", "CMD-" + System.currentTimeMillis());
if (binarySecurityToken != null) {
soapRequest = soapRequest.replaceFirst("<!-- BinarySecurityToken -->", binarySecurityToken);
}
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 SoapAddressingClient method sendMessage.
public static String sendMessage(String item, String quantity, String switchyard_web_service) throws Exception {
File testFile = getFile();
if (testFile.exists()) {
testFile.delete();
}
HTTPMixIn http = new HTTPMixIn();
http.initialize();
return http.postString(switchyard_web_service, String.format(SOAP_TEMPLATE, item, quantity));
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class XSLTClient 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 + "/quickstart-transform-xslt/OrderService";
String result = soapMixIn.postFile(url, XML);
System.out.println("SOAP Reply:\n" + result);
} finally {
soapMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class ValidationClient method main.
/**
* Only execution point for this application.
* @param send an invalid SOAP request if anything is specified.
* @throws Exception if something goes wrong.
*/
public static void main(final String[] args) 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 + "/quickstart-validate-xml/OrderService";
String request = args.length == 0 ? XML : XML_INVALID;
System.out.println("### Sending a SOAP request using " + request + ":");
String result = soapMixIn.postFile(url, request);
System.out.println("### SOAP Reply:");
System.out.println(result);
} finally {
soapMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.http.HTTPMixIn in project quickstarts by jboss-switchyard.
the class RulesInterviewClient 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 + "/rules-interview/Interview";
String result = soapMixIn.postFile(url, XML);
System.out.println("SOAP Reply:\n" + result);
} finally {
soapMixIn.uninitialize();
}
}
Aggregations