use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.
the class CamelTransportClientServerTest method testClientInvocation.
@Test
public void testClientInvocation() throws MalformedURLException {
Client client = new Client("http://localhost:" + port + "/GreeterContext/GreeterPort");
Greeter port = client.getProxy();
assertNotNull("The proxy should not be null", port);
String resp = port.sayHi();
assertEquals("Get a wrong response ", "Bonjour from EndpointA", resp);
resp = port.sayHi();
assertEquals("Get a wrong response ", "Bonjour from EndpointB", resp);
resp = port.greetMe("Mike");
assertEquals("Get a wrong response ", "Hello Mike from EndpointA", resp);
resp = port.greetMe("James");
assertEquals("Get a wrong response ", "Hello James from EndpointB", resp);
port.greetMeOneWay(System.getProperty("user.name"));
try {
port.pingMe("hello");
fail("exception expected but none thrown");
} catch (PingMeFault ex) {
assertEquals("Wrong exception message received", "PingMeFault raised by server EndpointB", ex.getMessage());
FaultDetail detail = ex.getFaultInfo();
assertEquals("Wrong FaultDetail major:", 2, detail.getMajor());
assertEquals("Wrong FaultDetail minor:", 1, detail.getMinor());
}
}
use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.
the class Client method invoke.
public void invoke() throws Exception {
System.out.println("Acquiring router port ...");
Greeter port = getProxy();
String resp;
System.out.println("Invoking sayHi...");
resp = port.sayHi();
System.out.println("Server responded with: " + resp);
System.out.println();
System.out.println("Invoking greetMe...");
resp = port.greetMe(System.getProperty("user.name"));
System.out.println("Server responded with: " + resp);
System.out.println();
System.out.println("Invoking greetMeOneWay...");
port.greetMeOneWay(System.getProperty("user.name"));
System.out.println("No response from server as method is OneWay");
System.out.println();
try {
System.out.println("Invoking pingMe, expecting exception...");
port.pingMe("hello");
} catch (PingMeFault ex) {
System.out.println("Expected exception: PingMeFault has occurred: " + ex.getMessage());
FaultDetail detail = ex.getFaultInfo();
System.out.println("FaultDetail major:" + detail.getMajor());
System.out.println("FaultDetail minor:" + detail.getMinor());
}
}
use of org.apache.hello_world_soap_http.PingMeFault in project camel by apache.
the class JmsPrepareResponse method process.
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
if ("greetMe".equals(in.getHeader(CxfConstants.OPERATION_NAME))) {
String request = in.getBody(String.class);
exchange.getOut().setBody("Hello" + request);
} else {
// throw the Exception
FaultDetail faultDetail = new FaultDetail();
faultDetail.setMajor((short) 2);
faultDetail.setMinor((short) 1);
exchange.getOut().setBody(new PingMeFault("PingMeFault raised by server", faultDetail));
exchange.getOut().setFault(true);
}
}
use of org.apache.hello_world_soap_http.PingMeFault in project cxf by apache.
the class GreeterImpl method pingMe.
public void pingMe() throws PingMeFault {
FaultDetail faultDetail = new FaultDetail();
faultDetail.setMajor((short) 2);
faultDetail.setMinor((short) 1);
LOG.info("Executing operation pingMe, throwing PingMeFault exception");
System.out.println("Executing operation pingMe, throwing PingMeFault exception\n");
throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
use of org.apache.hello_world_soap_http.PingMeFault in project cxf by apache.
the class GreeterImpl method pingMe.
public void pingMe() throws PingMeFault {
FaultDetail faultDetail = new FaultDetail();
faultDetail.setMajor((short) 2);
faultDetail.setMinor((short) 1);
LOG.info("Executing operation pingMe, throwing PingMeFault exception");
System.out.println("Executing operation pingMe, throwing PingMeFault exception\n");
throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Aggregations