Package org.switchyard.component.test.mixins.http

Examples of org.switchyard.component.test.mixins.http.HTTPMixIn


     * @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();
        }
    }
View Full Code Here


            SOAPUtil.prettyPrint(sendMessage(args[0], args[1], SWITCHYARD_WEB_SERVICE), System.out);
        }
    }

    public static String sendMessage(String item, String quantity, String switchyard_web_service) throws Exception {
        HTTPMixIn http = new HTTPMixIn();
        http.initialize();
        return http.postString(switchyard_web_service, String.format(SOAP_TEMPLATE, item, quantity));
    }
View Full Code Here

            int port = DEFAULT_PORT;
            String portstr = System.getProperty(KEY_PORT);
            if (portstr != null) {
                port = Integer.parseInt(portstr);
            }
            HTTPMixIn http = new HTTPMixIn();
            http.initialize();
            String endpointURL = "http://localhost:" + port + "/http-binding/quote";
            System.out.println(" Request: " + endpointURL + " -> " + args[0]);
            String response = http.sendString(endpointURL, args[0], HTTPMixIn.HTTP_POST);
            System.out.println("Response: " + response);
        }
    }
View Full Code Here

     * @param ignored not used.
     * @throws Exception if something goes wrong.
     */
    public static void main(final String[] args) throws Exception {

        HTTPMixIn soapMixIn = new HTTPMixIn();
        soapMixIn.initialize();

        String xmldir = args[0];
        try {
            String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
            String url = "http://localhost:" + port + "/xts_wsat/BusinessTravelService";
            String result = soapMixIn.postFile(url, xmldir + XML);
            System.out.println("SOAP Reply:\n" + result);
            result = soapMixIn.postFile(url, xmldir + XML_COMPLETE);
            System.out.println("SOAP Reply:\n" + result);
        } finally {
            soapMixIn.uninitialize();
        }
    }
View Full Code Here

    private static final Logger LOGGER = Logger.getLogger(HelpDeskMain.class);

    public static void main(String... args) throws Exception {
        final String ticketId = "TCKT-" + System.currentTimeMillis();
        final String soapRequest = new StringPuller().pull("/xml/soap-request.xml").replaceAll("TICKET_ID", ticketId);
        final HTTPMixIn http = new HTTPMixIn();
        http.initialize();
        try {
            String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
            http.postString("http://localhost:" + port + "/HelpDeskService/HelpDeskService", soapRequest);
            LOGGER.info("Started helpdesk process with ticket id: " + ticketId);
        } finally {
            http.uninitialize();
        }
    }
View Full Code Here

     * @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();
        }
    }
View Full Code Here

    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();
        }
    }
View Full Code Here

            return declaredType.cast(o);
        }
    }

    public static void main(String... args) throws Exception {
        HTTPMixIn httpMixIn = new HTTPMixIn();
        httpMixIn.initialize();
        try {
            String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
            LibraryClient client = new LibraryClient(httpMixIn, port);
            client.testLibraryServices();
        } finally {
            httpMixIn.uninitialize();
        }
    }
View Full Code Here

    private static final String MAVEN_USAGE = String.format("Maven Usage: mvn exec:java -Dexec.args=\"%s %s %s\"", CONFIDENTIALITY, CLIENT_AUTHENTICATION, HELP);

    private static void invokeWorkService(String scheme, int port, String context, String[] userPass) throws Exception {
        String soapRequest = new StringPuller().pull("/xml/soap-request.xml").replaceAll("WORK_CMD", "CMD-" + System.currentTimeMillis());
        HTTPMixIn http = new HTTPMixIn();
        if (userPass != null && userPass.length == 2) {
            http.setRequestHeader("Authorization", "Basic " + Base64.encodeFromString(userPass[0] + ":" + userPass[1]));
        }
        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();
        }
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        if (args.length == 0) {
            System.out.println("Usage: SoapBindingClient <some_name>");
            return;
        } else {
            HTTPMixIn http = new HTTPMixIn();
            http.initialize();
            String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
            SOAPUtil.prettyPrint(http.postString("http://localhost:" + port + "/soap-binding-rpc/HelloWorldWSService", String.format(SOAP_TEMPLATE, args[0], "English")), System.out);
        }
    }
View Full Code Here

TOP

Related Classes of org.switchyard.component.test.mixins.http.HTTPMixIn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.