Package org.apache.servicemix.client

Examples of org.apache.servicemix.client.ServiceMixClient.sendSync()


                // Send message
                MessageExchange exchange = createExchange(client);
                configureExchange(client, exchange);
                populateExchange(exchange);
                client.sendSync(exchange);
                checkResult(exchange);
                //assertNotNull(exchange.getMessage("out").getContent());
                // TODO: check out the exchange
                client.done(exchange);
View Full Code Here


        for (int i = 0; i < nbMsgs; i++) {
            InOnly me = client.createInOnlyExchange();
            me.setService(new QName("http://test", "entryPoint"));
            me.getInMessage().setContent(new StringSource(
                    "<test xmlns=\"http://test\"><echo/><world/><earth/></test>"));
            client.sendSync(me);
        }       
        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1 * nbMsgs);
        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1 * nbMsgs);
        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1 * nbMsgs);
        ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2 * nbMsgs);
 
View Full Code Here

    public void test() throws Exception {
        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOut me = client.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        me.setService(new QName("http://servicemix.org/test/", "routingSlip"));
        client.sendSync(me, 5000);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        client.done(me);
    }

}
View Full Code Here

            nm.setContent(new StringSource(content));
            me.setEndpoint(endpoint);
            if (operation != null) {
                me.setOperation(QNameUtil.parse(operation));
            }
            client.sendSync(me);
            if (me.getError() != null) {
                throw me.getError();
            } else if (me.getFault() != null) {
                throw FaultException.newInstance(me);
            } else if (me.getMessage("out") != null) {
View Full Code Here

            InOut exchange = client.createInOutExchange();
            exchange.setService(new QName("http://www.habuma.com/foo", "pingService"));
            NormalizedMessage in = exchange.getInMessage();
            in.setContent(new StringSource("<ping>Pinging you</ping>"));
            log.info("SENDING; exchange.status=" + exchange.getStatus());
            client.sendSync(exchange);
            assertNotNull(exchange.getOutMessage());
            log.info("GOT RESPONSE; exchange.out=" + new SourceTransformer().toString(exchange.getOutMessage().getContent()));
            client.done(exchange);
            // Wait for done to be delivered
            Thread.sleep(50);
View Full Code Here

       
        // define the destination endpoint
        exchange.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
       
        // send the exchange
        client.sendSync(exchange);
       
        // get the "out" normalized message
        NormalizedMessage outMessage = exchange.getOutMessage();
       
        // display the content of the "out" message
View Full Code Here

        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOnly me = client.createInOnlyExchange();
        me.setService(ReceiverComponent.SERVICE);
        me.getInMessage().setSecuritySubject(subject);
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
       
        receiver.getMessageList().assertMessagesReceived(1);
    }
   
    public void testNOk() throws Exception {
View Full Code Here

        InOnly me = client.createInOnlyExchange();
        me.setService(ReceiverComponent.SERVICE);
        me.getInMessage().setSecuritySubject(subject);
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        try {
            client.sendSync(me);
            fail("Should have thrown a SecurityException");
        } catch (SecurityException e) {
            // ok
        }
    }
View Full Code Here

        assertNotNull("We should find a service endpoint!", se);

        InOnly exchange = client.createInOnlyExchange();
        exchange.setEndpoint(se);
        exchange.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(exchange);

        assertExchangeWorked(exchange);

        ListenerBean bean = (ListenerBean) getBean("listenerBean");
        assertNotNull("Bean should bave been invoked", bean.getLastExchange());
View Full Code Here

        InOut me = client.createInOutExchange();
        me.setService(new QName("bean"));
        me.setOperation(new QName("receive"));
        NormalizedMessage nm = me.getInMessage();
        nm.setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        assertExchangeWorked(me);
        client.done(me);
    }
   
    protected void assertExchangeWorked(MessageExchange me) throws Exception {
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.