Package org.apache.servicemix.client

Examples of org.apache.servicemix.client.Destination


    }

    public void testInOnlyWithAsyncConsumer() throws Exception {
        TransactionManager tm = (TransactionManager) getBean("transactionManager");
        tm.begin();
        Destination dest = client.createDestination("endpoint:http://test/MyProviderService/async");
        InOnly me = dest.createInOnlyExchange();
        me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
        client.send(me);
        tm.commit();
        me = (InOnly) client.receive();
        assertEquals(ExchangeStatus.DONE, me.getStatus());
View Full Code Here


    }

    public void testInOnlySyncWithAsyncConsumer() throws Exception {
        TransactionManager tm = (TransactionManager) getBean("transactionManager");
        tm.begin();
        Destination dest = client.createDestination("endpoint:http://test/MyProviderService/async");
        InOnly me = dest.createInOnlyExchange();
        me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.DONE, me.getStatus());
        tm.commit();
        receiver.getMessageList().assertMessagesReceived(1);
View Full Code Here

    }

    public void testInOnlyWithSyncConsumer() throws Exception {
        TransactionManager tm = (TransactionManager) getBean("transactionManager");
        tm.begin();
        Destination dest = client.createDestination("endpoint:http://test/MyProviderService/synchronous");
        InOnly me = dest.createInOnlyExchange();
        me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
        client.send(me);
        tm.commit();
        me = (InOnly) client.receive();
        assertEquals(ExchangeStatus.DONE, me.getStatus());
View Full Code Here

    }

    public void testInOnlySyncWithSyncConsumer() throws Exception {
        TransactionManager tm = (TransactionManager) getBean("transactionManager");
        tm.begin();
        Destination dest = client.createDestination("endpoint:http://test/MyProviderService/synchronous");
        InOnly me = dest.createInOnlyExchange();
        me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.DONE, me.getStatus());
        tm.commit();
        receiver.getMessageList().assertMessagesReceived(1);
View Full Code Here

        Document doc = container.getRegistry().getEndpointDescriptor(se);
        String wsdl = new SourceTransformer().toString(doc);
        log.info(wsdl);
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        Destination dest = client.createDestination("service:http://jsr181.servicemix.apache.org/EchoWithAttachment");
        InOut me = dest.createInOutExchange();
        me.getInMessage().setContent(new StringSource(
                "<echo xmlns:xop='http://www.w3.org/2004/08/xop/include'><msg>"
                + "hello world</msg><binary><xop:Include href='binary'/></binary></echo>"));
        me.getInMessage().addAttachment("binary", new DataHandler(
                new ByteArrayDataSource(new byte[] {0, 1, 2}, "image/jpg")));
View Full Code Here

        HttpComponent http = new HttpComponent();
        http.setEndpoints(new HttpEndpoint[] {ep0, ep1});
        jbi.activateComponent(http, "http");

        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        Destination d = client.createDestination("service:urn:test:s0");
        InOut me = d.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
       
        tm.begin();
        boolean ok = client.sendSync(me);
        assertTrue(ok);
View Full Code Here

        HttpComponent http = new HttpComponent();
        http.setEndpoints(new HttpEndpoint[] {ep0, ep1});
        jbi.activateComponent(http, "http");

        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        Destination d = client.createDestination("service:urn:test:s0");
        InOut me = d.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
       
        tm.begin();
        client.send(me);
        tm.commit();
View Full Code Here

        container.activateComponent(http, "http");

        container.start();

        ServiceMixClient client = new DefaultServiceMixClient(container);
        Destination dest = client.createDestination("service:urn:test:s2");
        InOut me = dest.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        String str = new SourceTransformer().contentToString(me.getOutMessage());
        client.done(me);
View Full Code Here

        container.activateComponent(http, "http");

        container.start();

        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        Destination d = client.createDestination("service:urn:test:s0");
        InOut me = d.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        File f = new File(getClass().getResource("servicemix.jpg").getFile());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FileUtil.copyInputStream(new FileInputStream(f), baos);
        DataSource ds = new ByteArrayDataSource(baos.toByteArray(), "image/jpeg");
View Full Code Here

        Document doc = container.getRegistry().getEndpointDescriptor(se);
        String wsdl = new SourceTransformer().toString(doc);
        System.err.println(wsdl);
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        Destination dest = client.createDestination("service:http://jsr181.servicemix.apache.org/EchoWithAttachment");
        InOut me = dest.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<echo xmlns:xop='http://www.w3.org/2004/08/xop/include'><msg>hello world</msg><binary><xop:Include href='binary'/></binary></echo>"));
        me.getInMessage().addAttachment("binary", new DataHandler(new ByteArrayDataSource(new byte[] { 0, 1 , 2}, "image/jpg")));
       
        client.sendSync(me);
       
View Full Code Here

TOP

Related Classes of org.apache.servicemix.client.Destination

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.