use of org.apache.hello_world_soap_http.PingMeFault in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("please specify wsdl");
System.exit(1);
}
Server.main(new String[] { "inProcess" });
URL wsdlURL;
File wsdlFile = new File(args[0]);
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
System.out.println(wsdlURL);
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
Greeter port = ss.getSoapPort();
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();
try {
System.out.println("Invoking pingMe, expecting exception...");
port.pingMe();
} 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());
}
System.exit(0);
}
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 Client method main.
public static void main(String[] args) {
try {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = Client.class.getResource("/client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
SOAPService service = new SOAPService();
Greeter port = service.getSoapPort();
System.out.println("Invoking sayHi...");
String resp = port.sayHi();
System.out.println("Server responded with: " + resp + "\n");
System.out.println("Invoking greetMe...");
resp = port.greetMe(USER_NAME);
System.out.println("Server responded with: " + resp + "\n");
System.out.println("Invoking greetMeOneWay...");
port.greetMeOneWay(USER_NAME);
System.out.println("No response from server as method is OneWay\n");
try {
System.out.println("Invoking pingMe, expecting exception...");
port.pingMe();
} catch (PingMeFault ex) {
System.out.println("Expected exception occurred: " + ex);
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
System.exit(0);
}
}
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