Search in sources :

Example 1 with Greeter

use of org.apache.hello_world_soap12_http.Greeter in project cxf by apache.

the class Soap12ClientServerTest method testPingMeFault.

@Test
public void testPingMeFault() throws Exception {
    Greeter greeter = getGreeter();
    try {
        greeter.pingMe();
        fail("Should throw Exception!");
    } catch (PingMeFault ex) {
        FaultDetail detail = ex.getFaultInfo();
        assertEquals((short) 2, detail.getMajor());
        assertEquals((short) 1, detail.getMinor());
        assertEquals("PingMeFault raised by server", ex.getMessage());
    }
}
Also used : PingMeFault(org.apache.hello_world_soap12_http.PingMeFault) Greeter(org.apache.hello_world_soap12_http.Greeter) FaultDetail(org.apache.hello_world_soap12_http.types.FaultDetail) Test(org.junit.Test)

Example 2 with Greeter

use of org.apache.hello_world_soap12_http.Greeter in project cxf by apache.

the class Soap12ClientServerTest method testFaultMessage.

@Test
public void testFaultMessage() throws Exception {
    Greeter greeter = getGreeter();
    try {
        greeter.sayHi();
        fail("Should throw Exception!");
    } catch (SOAPFaultException ex) {
        assertEquals("sayHiFault Caused by: Get a wrong name <sayHi>", ex.getMessage());
        StackTraceElement[] element = ex.getCause().getStackTrace();
        assertEquals("org.apache.cxf.systest.soapfault.details.GreeterImpl12", element[0].getClassName());
    }
}
Also used : Greeter(org.apache.hello_world_soap12_http.Greeter) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 3 with Greeter

use of org.apache.hello_world_soap12_http.Greeter in project cxf by apache.

the class Soap12ClientServerTest method getGreeter.

private Greeter getGreeter() throws NumberFormatException, MalformedURLException {
    URL wsdl = getClass().getResource("/wsdl/hello_world_soap12.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl, serviceName);
    assertNotNull("Service is ull ", service);
    Greeter g = service.getPort(portName, Greeter.class);
    updateAddressPort(g, PORT);
    return g;
}
Also used : SOAPService(org.apache.hello_world_soap12_http.SOAPService) Greeter(org.apache.hello_world_soap12_http.Greeter) URL(java.net.URL)

Example 4 with Greeter

use of org.apache.hello_world_soap12_http.Greeter in project cxf by apache.

the class Soap12ClientServerTest method testBasicConnection.

@Test
public void testBasicConnection() throws Exception {
    Greeter greeter = getGreeter();
    for (int i = 0; i < 5; i++) {
        String echo = greeter.sayHi();
        assertEquals("Bonjour", echo);
    }
}
Also used : Greeter(org.apache.hello_world_soap12_http.Greeter) Test(org.junit.Test)

Example 5 with Greeter

use of org.apache.hello_world_soap12_http.Greeter in project cxf by apache.

the class Soap12ClientServerTest method getGreeter.

private Greeter getGreeter() throws NumberFormatException, MalformedURLException {
    URL wsdl = getClass().getResource("/wsdl/hello_world_soap12.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl, serviceName);
    assertNotNull("Service is ull ", service);
    Greeter g = service.getPort(portName, Greeter.class);
    updateAddressPort(g, PORT);
    return g;
}
Also used : SOAPService(org.apache.hello_world_soap12_http.SOAPService) Greeter(org.apache.hello_world_soap12_http.Greeter) URL(java.net.URL)

Aggregations

Greeter (org.apache.hello_world_soap12_http.Greeter)6 Test (org.junit.Test)4 URL (java.net.URL)2 PingMeFault (org.apache.hello_world_soap12_http.PingMeFault)2 SOAPService (org.apache.hello_world_soap12_http.SOAPService)2 FaultDetail (org.apache.hello_world_soap12_http.types.FaultDetail)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)1