Package org.apache.servicemix.client

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


        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://jsr181.servicemix.apache.org", "ComplexPojoPortType"));
        me.getInMessage().setContent(new StringSource("<hel lo>world</hello"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        assertNotNull(me.getFault());
        Node n = transformer.toDOMNode(me.getFault());
        log.info(transformer.toString(n));
        assertNotNull(textValueOfXPath(n, "/stack"));
View Full Code Here


        me.setOperation(new QName("getLoanQuote"));
        me.getMessage("in").setContent(new StringSource(
                                "<getLoanQuoteRequest xmlns=\"urn:logicblaze:soa:loanbroker\"><ssn>1234341</ssn>"
                                + "<amount>100000.0</amount><duration>12</duration></getLoanQuoteRequest>"));
        long t0 = System.currentTimeMillis();
        client.sendSync(me);
        long t1 = System.currentTimeMillis();
        if (me.getError() != null) {
            throw me.getError();
        }
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
View Full Code Here

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

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FileUtil.copyInputStream(new FileInputStream(f), baos);
        DataSource ds = new ByteArrayDataSource(baos.toByteArray(), "image/jpeg");
        DataHandler dh = new DataHandler(ds);
        me.getInMessage().addAttachment("image", dh);
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        assertEquals(1, me.getOutMessage().getAttachmentNames().size());
        client.done(me);
    }
View Full Code Here

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

        assertExchangeWorked(exchange);

        PlainBean bean = (PlainBean) getBean("plainBean");
        MessageExchange answer = bean.getFoo();
View Full Code Here

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

        assertExchangeWorked(exchange);

        PlainBean bean = (PlainBean) getBean("plainBean");
        MessageExchange bar = bean.getBar();
View Full Code Here

        exchange.setEndpoint(se);
        exchange.setOperation(new QName("methodWithPropertyParameter"));
        NormalizedMessage inMessage = exchange.getInMessage();
        inMessage.setProperty("person", "James");
        inMessage.setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(exchange);

        assertExchangeWorked(exchange);

        PlainBean bean = (PlainBean) getBean("plainBean");
        Object answer = bean.getPropertyParameter();
View Full Code Here

        exchange.setEndpoint(se);
        exchange.setOperation(new QName("methodWithPropertyParameterAndXPath"));
        NormalizedMessage inMessage = exchange.getInMessage();
        inMessage.setProperty("person", "James");
        inMessage.setContent(new StringSource("<hello address='London'>world</hello>"));
        client.sendSync(exchange);

        assertExchangeWorked(exchange);

        PlainBean bean = (PlainBean) getBean("plainBean");
        Object property = bean.getPropertyParameter();
View Full Code Here

    public void test() throws Exception {
        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://test", "EchoPortType"));
        me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
        client.sendSync(me);
        if (me.getStatus() == ExchangeStatus.ERROR) {
            if (me.getFault() != null) {
                fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
            } else if (me.getError() != null) {
                throw me.getError();
View Full Code Here

        exchange.setEndpoint(se);
        exchange.setOperation(new QName("methodWithPropertyParameterAndContent"));
        NormalizedMessage inMessage = exchange.getInMessage();
        inMessage.setProperty("person", "James");
        inMessage.setContent(new StringSource("<hello address='London'>world</hello>"));
        client.sendSync(exchange);

        assertExchangeWorked(exchange);

        PlainBean bean = (PlainBean) getBean("plainBean");
        Object property = bean.getPropertyParameter();
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.