Package javax.jbi.messaging

Examples of javax.jbi.messaging.InOut.createMessage()


            return;
        }
        System.err.println(getService().getLocalPart() + " requested");
        try {
            String output = "<getLoanQuoteResponse xmlns=\"urn:logicblaze:soa:bank\"><rate>" + (Math.ceil(1000 * Math.random()) / 100) + "</rate></getLoanQuoteResponse>";
            NormalizedMessage answer = inOut.createMessage();
            answer.setContent(new StringSource(output));
            answer(inOut, answer);
        } catch (Exception e) {
            throw new MessagingException(e);
        }
View Full Code Here


                } else if ("getCreditHistoryLength".equals(operation)) {
                    output = "<getCreditHistoryLengthResponse xmlns=\"urn:logicblaze:soa:creditagency\"><length>" + getCreditHistoryLength(ssn) + "</length></getCreditHistoryLengthResponse>";
                } else {
                    throw new UnsupportedOperationException(operation);
                }
                NormalizedMessage answer = inOut.createMessage();
                answer.setContent(new StringSource(output));
                answer(inOut, answer);
            }
        } catch (Exception e) {
            throw new MessagingException(e);
View Full Code Here

        return exchange;
    }

    public InOut createInOutExchange() throws MessagingException {
        InOut exchange = getExchangeFactory().createInOutExchange();
        NormalizedMessage in = exchange.createMessage();
        exchange.setInMessage(in);
        return exchange;
    }

    public InOut createInOutExchange(EndpointResolver resolver) throws JBIException {
View Full Code Here

     */
    public MessageExchange sendRawInOutRequest(QName service, Source source)
        throws MessagingException {
        InOut inOut = channel.createExchangeFactoryForService(service)
                .createInOutExchange();
        NormalizedMessage msg = inOut.createMessage();
        msg.setContent(source);
        inOut.setInMessage(msg);
        if (channel.sendSync(inOut)) {
            return inOut;
        } else {
View Full Code Here

     */
    public Source sendRequest(QName service, Source source)
        throws MessagingException {
        InOut inOut = channel.createExchangeFactoryForService(service)
                .createInOutExchange();
        NormalizedMessage msg = inOut.createMessage();
        msg.setContent(source);
        inOut.setInMessage(msg);

        if (channel.sendSync(inOut)) {
            SourceTransformer sourceTransformer = new SourceTransformer();
View Full Code Here

        return exchange;
    }

    public InOut createInOutExchange() throws MessagingException {
        InOut exchange = getExchangeFactory().createInOutExchange();
        NormalizedMessage in = exchange.createMessage();
        exchange.setInMessage(in);
        return exchange;
    }

    public InOut createInOutExchange(EndpointResolver resolver) throws JBIException {
View Full Code Here

    public void testInOut() throws Exception {
        // Send message exchange
        MessageExchangeFactory mef = consumer.getChannel().createExchangeFactoryForService(new QName("provider"));
        InOut mec = mef.createInOutExchange();
        NormalizedMessage m = mec.createMessage();
        m.setContent(new StringSource(PAYLOAD));
        mec.setInMessage(m);
        consumer.getChannel().send(mec);
        // Provider side
        InOut mep = (InOut) provider.getChannel().accept(100L);
View Full Code Here

        consumer.getChannel().send(mec);
        // Provider side
        InOut mep = (InOut) provider.getChannel().accept(100L);
        assertNotNull(mep);
        assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
        m = mep.createMessage();
        m.setContent(new StringSource(RESPONSE));
        mep.setOutMessage(m);
        provider.getChannel().send(mep);
        // Consumer side
        mec = (InOut) consumer.getChannel().accept(100L);
View Full Code Here

                try {
                    // Provider side
                    InOut mep = (InOut) provider.getChannel().accept(10000L);
                    assertNotNull(mep);
                    assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
                    NormalizedMessage m = mep.createMessage();
                    m.setContent(new StringSource(RESPONSE));
                    mep.setOutMessage(m);
                    provider.getChannel().send(mep);
                } catch (Exception e) {
                    e.printStackTrace();
View Full Code Here

            }
        }).start();
        // Send message exchange
        MessageExchangeFactory mef = consumer.getChannel().createExchangeFactoryForService(new QName("provider"));
        InOut mec = mef.createInOutExchange();
        NormalizedMessage m = mec.createMessage();
        m.setContent(new StringSource(PAYLOAD));
        mec.setInMessage(m);
        consumer.getChannel().sendSync(mec, 10000L);
        assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
        mec.setStatus(ExchangeStatus.DONE);
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.