Search in sources :

Example 11 with PingMeFault

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);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) PingMeFault(org.apache.hello_world_soap_http.PingMeFault) Greeter(org.apache.hello_world_soap_http.Greeter) FaultDetail(org.apache.hello_world_soap_http.types.FaultDetail) File(java.io.File) URL(java.net.URL)

Example 12 with PingMeFault

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);
}
Also used : PingMeFault(org.apache.hello_world_soap_http.PingMeFault) FaultDetail(org.apache.hello_world_soap_http.types.FaultDetail)

Example 13 with PingMeFault

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);
    }
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) PingMeFault(org.apache.hello_world_soap_http.PingMeFault) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world_soap_http.Greeter) URL(java.net.URL)

Example 14 with PingMeFault

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);
}
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)14 FaultDetail (org.apache.hello_world_soap_http.types.FaultDetail)12 Greeter (org.apache.hello_world_soap_http.Greeter)5 Test (org.junit.Test)3 URL (java.net.URL)2 SOAPService (org.apache.hello_world_soap_http.SOAPService)2 File (java.io.File)1 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 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1