Package javax.jbi.messaging

Examples of javax.jbi.messaging.Fault


            if (boi.getOperationInfo().isOneWay()) {
                messageExchange.setStatus(ExchangeStatus.DONE);
            } else if (soapMessage.get("jbiFault") != null
                    && soapMessage.get("jbiFault").equals(true)) {
                Fault fault = messageExchange.createFault();
                fault.setContent(soapMessage.getContent(Source.class));
                messageExchange.setFault(fault);
            } else if (messageExchange instanceof InOut) {
                NormalizedMessage msg = messageExchange.createMessage();
                msg.setContent(soapMessage.getContent(Source.class));
                messageExchange.setMessage(msg, "out");
View Full Code Here


                throw new IllegalStateException("Exchange status is " + ExchangeStatus.DONE);
            } else if (me.getStatus() == ExchangeStatus.ERROR) {
                fail(exchange, me.getError());
                return;
            } else if (me.getFault() != null) {
                Fault fault = MessageUtil.copyFault(me);
                MessageUtil.transferToFault(fault, exchange);
                done(me);
                sendSync(exchange);
                return;
            } else if (me.getOutMessage() == null) {
View Full Code Here

    public void handleResponse(MessageExchange exchange, SmxHttpExchange httpExchange) throws Exception {
        int response = httpExchange.getResponseStatus();
        if (response != HttpStatus.SC_OK && response != HttpStatus.SC_ACCEPTED) {
            if (!(exchange instanceof InOnly)) {
                Fault fault = exchange.createFault();
                fault.setContent(new StreamSource(httpExchange.getResponseReader()));
                exchange.setFault(fault);
            } else {
                throw new Exception("Invalid status response: " + response);
            }
        } else if (exchange instanceof InOut) {
View Full Code Here

                    Header contentType = method.getResponseHeader(HEADER_CONTENT_TYPE);
                    soapMessage = reader.read(method.getResponseBodyAsStream(),
                                              contentType != null ? contentType.getValue() : null);
                    context.setFaultMessage(soapMessage);
                    soapHelper.onAnswer(context);
                    Fault fault = exchange.createFault();
                    fault.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
                    soapHelper.getJBIMarshaler().toNMS(fault, soapMessage);
                    exchange.setFault(fault);
                    if (txSync) {
                        channel.sendSync(exchange);
                    } else {
View Full Code Here

            if (e.getCause() instanceof Exception) {
                WebFault fa = (WebFault) e.getCause().getClass().getAnnotation(WebFault.class);
                if (!(exchange instanceof InOnly) && fa != null) {
                    BaseFaultType info = (BaseFaultType) e.getCause().getClass().getMethod("getFaultInfo").invoke(
                            e.getCause());
                    Fault fault = exchange.createFault();
                    exchange.setFault(fault);
                    exchange.setError((Exception) e.getCause());
                    StringWriter writer = new StringWriter();
                    jaxbContext.createMarshaller().marshal(new JbiFault(info), writer);
                    fault.setContent(new StringSource(writer.toString()));
                    channel.send(exchange);
                    return;
                } else {
                    throw (Exception) e.getCause();
                }
View Full Code Here

                        sendSync(exchange);
                    } else {
                        send(exchange);
                    }
                } else if (exchange.getFault() == null) {
                    Fault fault = exchange.createFault();
                    fault.setContent(createSource("<fault/>"));
                    exchange.setMessage(fault, "fault");
                    if (txSync) {
                        sendSync(exchange);
                    } else {
                        send(exchange);
View Full Code Here

    }
   
    protected static class ReturnFaultComponent extends ComponentSupport implements MessageExchangeListener {
        public void onMessageExchange(MessageExchange exchange) throws MessagingException {
            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                Fault fault = exchange.createFault();
                fault.setContent(createSource("<fault/>"));
                fail(exchange, fault);
            }
        }
View Full Code Here

        if (tme.getStatus() == ExchangeStatus.DONE) {
            done(exchange);
        } else if (tme.getStatus() == ExchangeStatus.ERROR) {
            fail(exchange, tme.getError());
        } else if (tme.getFault() != null) {
            Fault fault = MessageUtil.copyFault(tme);
            done(tme);
            MessageUtil.transferToFault(fault, exchange);
            sendSync(exchange);
        } else if (tme.getMessage("out") != null) {
            NormalizedMessage out = MessageUtil.copyOut(tme);
View Full Code Here

                    // So just transform it to a string and send an error
                    String fault = new SourceTransformer().contentToString(me.getFault());
                    done(me);
                    fail(exchange, new FaultException(fault, null, null));
                } else {
                    Fault fault = MessageUtil.copyFault(me);
                    MessageUtil.transferToFault(fault, exchange);
                    done(me);
                    sendSync(exchange);
                }
            } else {
View Full Code Here

                    // So just transform it to a string and send an error
                    String fault = new SourceTransformer().contentToString(me.getFault());
                    done(me);
                    fail(exchange, new FaultException(fault, null, null));
                } else {
                    Fault fault = MessageUtil.copyFault(me);
                    MessageUtil.transferToFault(fault, exchange);
                    done(me);
                    sendSync(exchange);
                }
            } else {
                throw new IllegalStateException("Exchange status is " + ExchangeStatus.ACTIVE
                        + " but has no correlation set");
            }
        // Faults must be sent back to the consumer
        } else {
            if (exchange instanceof InOnly) {
                // Do not use the fault has it may contain streams
                // So just transform it to a string and send an error
                String fault = new SourceTransformer().contentToString(tme.getFault());
                done(tme);
                fail(exchange, new FaultException(fault, null, null));
            } else {
                Fault fault = MessageUtil.copyFault(tme);
                MessageUtil.transferToFault(fault, exchange);
                done(tme);
                sendSync(exchange);
            }
        }
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.Fault

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.