Package org.apache.camel.non_wrapper.types

Examples of org.apache.camel.non_wrapper.types.GetPersonResponse


            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + port1 + "/CxfNonWrapperTest/PersonService/");
       
        GetPerson request = new GetPerson();
        request.setPersonId("hello");
        GetPersonResponse response = client.getPerson(request);

        assertEquals("we should get the right answer from router", "Bonjour", response.getName());

        request.setPersonId("");
        try {
            client.getPerson(request);
            fail("We expect to get the UnknowPersonFault here");
View Full Code Here


            LOG.info("boi.isUnwrapped" + boi.isUnwrapped());
        }

        GetPerson person =  exchange.getIn().getBody(GetPerson.class);
        String personId = person.getPersonId();
        GetPersonResponse response = new GetPersonResponse();

        if (personId == null || personId.length() == 0) {
            LOG.info("person id 123, so throwing exception");
            // Try to throw out the soap fault message
            org.apache.camel.non_wrapper.types.UnknownPersonFault personFault =
                new org.apache.camel.non_wrapper.types.UnknownPersonFault();
            personFault.setPersonId("");
            org.apache.camel.non_wrapper.UnknownPersonFault fault =
                new org.apache.camel.non_wrapper.UnknownPersonFault("Get the null value of person name", personFault);
            // Since camel has its own exception handler framework, we can't throw the exception to trigger it
            // We just set the fault message in the exchange for camel-cxf component handling and return
            exchange.getOut().setFault(true);
            exchange.getOut().setBody(fault);
            return;
        }
        response.setPersonId(personId);
        response.setName("Bonjour");
        response.setSsn("123");
        LOG.info("setting Bonjour as the response");
        // Set the response message, first element is the return value of the operation,
        // the others are the holders of method parameters
        exchange.getOut().setBody(new Object[] {response});
    }
View Full Code Here

        }
    }

    private static class AfterProcessor implements Processor {
        public void process(Exchange e) throws Exception {
            GetPersonResponse gpr = new GetPersonResponse();
            gpr.setName("Bill");
            gpr.setPersonId(e.getIn().getBody(String.class));
            gpr.setSsn("Test");

            MessageContentsList mclOut = new MessageContentsList();
            mclOut.set(0, gpr);
            e.getOut().setBody(mclOut, MessageContentsList.class);
        }
View Full Code Here

            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + port1 + "/CxfNonWrapperTest/PersonService/");
       
        GetPerson request = new GetPerson();
        request.setPersonId("hello");
        GetPersonResponse response = client.getPerson(request);

        assertEquals("we should get the right answer from router", "Bonjour", response.getName());

        request.setPersonId("");
        try {
            client.getPerson(request);
            fail("We expect to get the UnknowPersonFault here");
View Full Code Here

            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + port1 + "/PersonService/");
       
        GetPerson request = new GetPerson();
        request.setPersonId("hello");
        GetPersonResponse response = client.getPerson(request);

        assertEquals("we should get the right answer from router", "Bonjour", response.getName());

        request.setPersonId("");
        try {
            client.getPerson(request);
            fail("We expect to get the UnknowPersonFault here");
View Full Code Here

        factory.setServiceClass(Person.class);
        Person person = factory.create(Person.class);
        GetPerson payload = new GetPerson();
        payload.setPersonId("1234");
       
        GetPersonResponse reply = person.getPerson(payload);
        assertEquals("Get the wrong person id.", "1234",  reply.getPersonId());
       
    }
View Full Code Here

                    public void process(Exchange exchange) throws Exception {
                        // just try to turn the payload to the parameter we want
                        // to use
                        GetPerson request = exchange.getIn().getBody(GetPerson.class);

                        GetPersonResponse reply = new GetPersonResponse();
                        reply.setPersonId(request.getPersonId());
                        exchange.getOut().setBody(reply);
                    }

                });
            }
View Full Code Here

            LOG.info("boi.isUnwrapped" + boi.isUnwrapped());
        }

        GetPerson person =  exchange.getIn().getBody(GetPerson.class);
        String personId = person.getPersonId();
        GetPersonResponse response = new GetPersonResponse();

        if (personId == null || personId.length() == 0) {
            LOG.info("person id 123, so throwing exception");
            // Try to throw out the soap fault message
            org.apache.camel.non_wrapper.types.UnknownPersonFault personFault =
                new org.apache.camel.non_wrapper.types.UnknownPersonFault();
            personFault.setPersonId("");
            org.apache.camel.non_wrapper.UnknownPersonFault fault =
                new org.apache.camel.non_wrapper.UnknownPersonFault("Get the null value of person name", personFault);
            // Since camel has its own exception handler framework, we can't throw the exception to trigger it
            // We just set the fault message in the exchange for camel-cxf component handling and return
            exchange.getOut().setFault(true);
            exchange.getOut().setBody(fault);
            return;
        }
        response.setPersonId(personId);
        response.setName("Bonjour");
        response.setSsn("123");
        LOG.info("setting Bonjour as the response");
        // Set the response message, first element is the return value of the operation,
        // the others are the holders of method parameters
        exchange.getOut().setBody(new Object[] {response});
    }
View Full Code Here

            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + port1 + "/CxfNonWrapperTest/PersonService/");
       
        GetPerson request = new GetPerson();
        request.setPersonId("hello");
        GetPersonResponse response = client.getPerson(request);

        assertEquals("we should get the right answer from router", "Bonjour", response.getName());

        request.setPersonId("");
        try {
            client.getPerson(request);
            fail("We expect to get the UnknowPersonFault here");
View Full Code Here

        factory.setServiceClass(Person.class);
        Person person = factory.create(Person.class);
        GetPerson payload = new GetPerson();
        payload.setPersonId("1234");
       
        GetPersonResponse reply = person.getPerson(payload);
        assertEquals("Get the wrong person id.", "1234",  reply.getPersonId());
       
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.non_wrapper.types.GetPersonResponse

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.