Search in sources :

Example 6 with PingMeFault

use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.

the class GreeterImpl method pingMe.

public void pingMe(String messageIn) throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    LOG.info("Executing operation pingMe, throwing PingMeFault exception, message = " + messageIn);
    System.out.println("Executing operation pingMe, throwing PingMeFault exception\n");
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : PingMeFault(org.apache.hello_world_soap_http.PingMeFault) FaultDetail(org.apache.hello_world_soap_http.types.FaultDetail)

Example 7 with PingMeFault

use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.

the class CamelGreeterConsumerTest method testInvokeServers.

@Test
public void testInvokeServers() throws Exception {
    assertNotNull(camelContext);
    ProducerTemplate template = camelContext.createProducerTemplate();
    List<String> params = new ArrayList<String>();
    params.add("Willem");
    Object result = template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut, params, CxfConstants.OPERATION_NAME, "greetMe");
    assertTrue("Result is a list instance ", result instanceof List);
    assertEquals("Get the wrong response", ((List<?>) result).get(0), "HelloWillem");
    try {
        template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut, params, CxfConstants.OPERATION_NAME, "pingMe");
        fail("Expect exception here.");
    } catch (Exception ex) {
        assertTrue("Get a wrong exception.", ex instanceof CamelExecutionException);
        assertTrue("Get a wrong exception cause. ", ex.getCause() instanceof PingMeFault);
    }
    template.stop();
}
Also used : CamelExecutionException(org.apache.camel.CamelExecutionException) ProducerTemplate(org.apache.camel.ProducerTemplate) PingMeFault(org.apache.hello_world_soap_http.PingMeFault) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CamelExecutionException(org.apache.camel.CamelExecutionException) Test(org.junit.Test)

Example 8 with PingMeFault

use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.

the class GreeterImpl method pingMe.

public void pingMe(String messageIn) throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    LOG.info("Executing operation pingMe, throwing PingMeFault exception, message = " + messageIn);
    LOG.info("Executing operation pingMe, throwing PingMeFault exception\n");
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : PingMeFault(org.apache.hello_world_soap_http.PingMeFault) FaultDetail(org.apache.hello_world_soap_http.types.FaultDetail)

Aggregations

PingMeFault (org.apache.hello_world_soap_http.PingMeFault)8 FaultDetail (org.apache.hello_world_soap_http.types.FaultDetail)7 Greeter (org.apache.hello_world_soap_http.Greeter)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CamelExecutionException (org.apache.camel.CamelExecutionException)1 Message (org.apache.camel.Message)1 ProducerTemplate (org.apache.camel.ProducerTemplate)1