Package javax.jbi.messaging

Examples of javax.jbi.messaging.Fault


    public void testSoapFault12() throws Exception {
        TransformComponentSupport echo = new TransformComponentSupport() {
            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
                throws MessagingException {
                Fault f = exchange.createFault();
                f.setContent(new StringSource("<hello xmlns='myuri'>this is a fault</hello>"));
                f.setProperty(JBIMarshaler.SOAP_FAULT_REASON, "My reason");
                throw new FaultException(null, exchange, f);
            }
        };
        echo.setService(new QName("urn:test", "echo"));
        echo.setEndpoint("echo");
View Full Code Here


    public void testSoapFault11() throws Exception {
        TransformComponentSupport echo = new TransformComponentSupport() {
            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
                throws MessagingException {
                Fault f = exchange.createFault();
                f.setContent(new StringSource("<hello xmlns='myuri'>this is a fault</hello>"));
                f.setProperty(JBIMarshaler.SOAP_FAULT_REASON, "My reason");
                throw new FaultException(null, exchange, f);
            }
        };
        echo.setService(new QName("urn:test", "echo"));
        echo.setEndpoint("echo");
View Full Code Here

        InOut exchange = client.createInOutExchange();
        exchange.getInMessage().setContent(getSourceFromClassPath("requestValid.xml"));
        client.sendSync(exchange);

        NormalizedMessage out = exchange.getOutMessage();
        Fault fault = exchange.getFault();
        Exception error = exchange.getError();

        assertEquals("error", null, error);
        assertEquals("fault", null, fault);
View Full Code Here

        InOut exchange = client.createInOutExchange();
        exchange.getInMessage().setContent(getSourceFromClassPath("requestInvalid.xml"));
        client.sendSync(exchange);

        NormalizedMessage out = exchange.getOutMessage();
        Fault fault = exchange.getFault();
        Exception error = exchange.getError();

        assertEquals("out", null, out);
        assertNotNull("Should have a fault", fault);

        System.out.println("error is: " + error);

        System.out.println("Fault is...");
        System.out.println(transformer.toString(fault.getContent()));

        // TODO?
        //assertEquals("error", null, error);
    }
View Full Code Here

                deliveryChannel.send(inOnly);
                done(exchange);
            }
            else if (exchange instanceof InOnly == false) {
                inOnly.setError(rpc.getError());
                Fault fault = rpc.getFault();
                fail(exchange, fault);
            }
            else {
                // TODO: log error
            }
View Full Code Here

          // As we expect a DOMResult as output, we must ensure that the input is a
          // DOMSource
          Source src = new SourceTransformer().toDOMSource(out.getContent());
            validator.validate(src, result);
            if (errorHandler.hasErrors()) {
                Fault fault = exchange.createFault();
                fault.setProperty("org.servicemix.schema", schema);
                fault.setContent(new DOMSource(result.getNode(), result.getSystemId()));
                throw new FaultException("Failed to validate against schema: " + schema, exchange, fault);
            }
            else {
              // Retrieve the ouput of the validation
              // as it may have been changed by the validator
View Full Code Here

            boolean answer = operation.executeRequestResponseOperation(inMessage, outMessage, faultMessage);
            if (answer) {
                marshaler.toNMS(exchange, out, operationInfo, outMessage);
            }
            else {
                Fault fault = exchange.createFault();
                marshaler.toNMS(exchange, fault, operationInfo, outMessage);
                exchange.setFault(fault);
            }
            return true;
        }
View Full Code Here

        getMessageTransformer().transform(exchange, in, request);
        inOut.setInMessage(request);
        getDeliveryChannel().sendSync(inOut);

        NormalizedMessage response = inOut.getOutMessage();
        Fault fault = inOut.getFault();
        Exception error = inOut.getError();
        if (fault != null) {
            fail(exchange, fault);
        }
        else if (error != null) {
View Full Code Here

        if (answer) {
            NormalizedMessage outMessage = exchange.getOutMessage();
            return marshaler.createStreamReader(outMessage);
        }
        else {
            Fault fault = exchange.getFault();
            return marshaler.createStreamReader(fault);
        }
    }
View Full Code Here

            Exception error = exchange.getError();
            if (error != null) {
                throw error;
            }

            Fault fault = exchange.getFault();
            assertEquals("Should have no fault!", null, fault);
        }
    }
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.