Search in sources :

Example 1 with Greeter

use of org.apache.hello_world_xml_http.bare.Greeter in project cxf by apache.

the class ClientServerXMLTest method testBareBasicConnection.

@Test
public void testBareBasicConnection() throws Exception {
    XMLService service = new XMLService();
    assertNotNull(service);
    String response1 = "Hello ";
    String response2 = "Bonjour";
    try {
        Greeter greeter = service.getPort(barePortName, Greeter.class);
        updateAddressPort(greeter, REG_PORT);
        String username = System.getProperty("user.name");
        String reply = greeter.greetMe(username);
        assertNotNull("no response received from service", reply);
        assertEquals(response1 + username, reply);
        reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals(response2, reply);
        MyComplexStructType argument = new MyComplexStructType();
        MyComplexStructType retVal = null;
        String str1 = "this is element 1";
        String str2 = "this is element 2";
        int int1 = 42;
        argument.setElem1(str1);
        argument.setElem2(str2);
        argument.setElem3(int1);
        retVal = greeter.sendReceiveData(argument);
        assertEquals(str1, retVal.getElem1());
        assertEquals(str2, retVal.getElem2());
        assertEquals(int1, retVal.getElem3());
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }
}
Also used : XMLService(org.apache.hello_world_xml_http.bare.XMLService) Greeter(org.apache.hello_world_xml_http.bare.Greeter) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) MyComplexStructType(org.apache.hello_world_xml_http.bare.types.MyComplexStructType) Test(org.junit.Test)

Aggregations

UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 Greeter (org.apache.hello_world_xml_http.bare.Greeter)1 XMLService (org.apache.hello_world_xml_http.bare.XMLService)1 MyComplexStructType (org.apache.hello_world_xml_http.bare.types.MyComplexStructType)1 Test (org.junit.Test)1