Search in sources :

Example 1 with Greeter

use of org.apache.hello_world_xml_http.wrapped.Greeter 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);
    }
    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);
    XMLService ss = new XMLService(wsdlURL, SERVICE_NAME);
    Greeter port = ss.getXMLPort();
    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();
    } catch (PingMeFault ex) {
        System.out.println("Expected exception: " + ex.getMessage());
    }
    System.exit(0);
}
Also used : PingMeFault(org.apache.hello_world_xml_http.wrapped.PingMeFault) XMLService(org.apache.hello_world_xml_http.wrapped.XMLService) Greeter(org.apache.hello_world_xml_http.wrapped.Greeter) File(java.io.File) URL(java.net.URL)

Aggregations

File (java.io.File)1 URL (java.net.URL)1 Greeter (org.apache.hello_world_xml_http.wrapped.Greeter)1 PingMeFault (org.apache.hello_world_xml_http.wrapped.PingMeFault)1 XMLService (org.apache.hello_world_xml_http.wrapped.XMLService)1