use of org.apache.hello_world_xml_http.bare.XMLService in project cxf by apache.
the class ClientServerXMLTest method testAddPort.
@Test
public void testAddPort() throws Exception {
URL url = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl");
Service service = Service.create(url, wrapServiceName);
assertNotNull(service);
service.addPort(wrapFakePortName, "http://cxf.apache.org/bindings/xformat", "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort");
String response1 = new String("Hello ");
String response2 = new String("Bonjour");
org.apache.hello_world_xml_http.wrapped.Greeter greeter = service.getPort(wrapPortName, org.apache.hello_world_xml_http.wrapped.Greeter.class);
updateAddressPort(greeter, WRAP_PORT);
try {
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);
BindingProvider bp = (BindingProvider) greeter;
Map<String, Object> responseContext = bp.getResponseContext();
Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
assertEquals(200, responseCode.intValue());
greeter.greetMeOneWay(System.getProperty("user.name"));
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_xml_http.bare.XMLService 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();
}
}
Aggregations