Package org.switchyard

Examples of org.switchyard.Exchange.createMessage()


                if (args == null) {
                    exchange.send(exchange.createMessage());
                } else if (args.length == 1) {
                    exchange.send(exchange.createMessage().setContent(args[0]));
                } else {
                    exchange.send(exchange.createMessage().setContent(args));
                }

                Object propagateException = _service.getDomain().getProperty(Exchange.PROPAGATE_EXCEPTION_ON_IN_ONLY);
                if (propagateException != null && Boolean.parseBoolean(propagateException.toString())
                        && exchange.getState().equals(ExchangeState.FAULT)) {
View Full Code Here


           
            // Need to create an exchange
            SynchronousInOutHandler rh = new SynchronousInOutHandler();
            Exchange exchange=_serviceReference.createExchange(operationName, rh);

            Message req = exchange.createMessage();
            req.setContent(node);
            if (headers != null) {
               
                for (Map.Entry<String, Object> e : headers.entrySet()) {
                    exchange.getContext(req).setProperty(e.getKey(), headers.get(e.getKey())).addLabels(EndpointLabel.SOAP.label());
View Full Code Here

        ServiceReference service = _domain.createInOutService(serviceName, provider);
       
        // Consume the service
        MockHandler consumer = new MockHandler();
        Exchange exchange = service.createExchange(consumer);
        exchange.send(exchange.createMessage());
       
        // wait, since this is async
        provider.waitForOKMessage();
        consumer.waitForOKMessage();
    }
View Full Code Here

        ServiceReference service = _domain.createInOutService(serviceName, provider);
       
        // Consume the service
        MockHandler consumer = new MockHandler();
        Exchange exchange = service.createExchange(consumer);
        exchange.send(exchange.createMessage());
       
        // wait, since this is async
        provider.waitForOKMessage();
        consumer.waitForFaultMessage();
       
View Full Code Here

        ServiceReference service = _domain.createInOnlyService(serviceName, provider);
       
        // Consume the service
        Exchange exchange = service.createExchange();
        exchange.send(exchange.createMessage());
       
        // wait a sec, since this is async
        Thread.sleep(200);
        Assert.assertTrue(inEvents.size() == 1);
    }
View Full Code Here

            Exchange exchange = service.createExchange();

            // Set the message name.  NOTE: setting to the to message
            // name will not be necessary once the service definition is available
            // at runtime
            Message msg = exchange.createMessage().setContent(input);
            msg.getContext().setProperty(Exchange.CONTENT_TYPE, typeName);

            msg.setContent(input);
            exchange.send(msg);
View Full Code Here

        Exchange exchange = service.createExchange(invokerHandler);

        // Set the message name.  NOTE: setting to the to message
        // name will not be necessary once the service definition is available
        // at runtime
        Message msg = exchange.createMessage().setContent(input);
        msg.getContext().setProperty(Exchange.CONTENT_TYPE, typeName);

        msg.setContent(input);

        exchange.send(msg);
View Full Code Here

            Exchange exchange = service.createExchange(invokerHandler);
       
            // Set the from and to message names.  NOTE: setting to the to message
            // name will not be necessary once the service definition is available
            // at runtime
            Message msg = exchange.createMessage().setContent(input);
            TransformSequence.
                    from(inType).
                    to(finalDestOutType).
                    associateWith(msg);
       
View Full Code Here

    @Test
    public void testFaultReportedOnInOnly() {
        ServiceReference ref = registerInOnlyService("inOut", new ErrorExchangeHandler());
        MockHandler consumer = new MockHandler();
        Exchange exchange = ref.createExchange(consumer);
        exchange.send(exchange.createMessage().setContent("test"));
       
        Assert.assertEquals(1, consumer.waitForFaultMessage().getFaults().size());
    }

    /**
 
View Full Code Here

        return reference;
    }

    private Exchange sendMessage(ServiceReference ref, Object content) {
        Exchange exchange = ref.createExchange(new MockHandler());
        exchange.send(exchange.createMessage().setContent(content));
        return exchange;
    }
   
    private ServiceReference registerInOutServiceWithTypes(
            String serviceName, QName inputType, QName outputType, ExchangeHandler handler) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.