use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class ClientServerTest method testNillable.
@Test
public void testNillable() throws Exception {
SOAPService service = new SOAPService();
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
updateAddressPort(greeter, PORT);
try {
String reply = greeter.testNillable("test", 100);
assertEquals("test", reply);
reply = greeter.testNillable(null, 100);
assertNull(reply);
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class ClientServerTest method testAddPort.
@Test
public void testAddPort() throws Exception {
Service service = Service.create(serviceName);
service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/", "http://localhost:" + PORT + "/SoapContext/SoapPort");
Greeter greeter = service.getPort(fakePortName, Greeter.class);
String response = new String("Bonjour");
try {
greeter.greetMe("test");
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response, reply);
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
URL wsdlURL = Client.class.getResource("/wsdl/hello_world.wsdl");
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.exit(0);
}
use of org.apache.hello_world_soap_http.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);
}
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);
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class NettyClientTest method testInovationWithNettyAddress.
@Test
public void testInovationWithNettyAddress() throws Exception {
String address = "netty://http://localhost:" + PORT + "/SoapContext/SoapPort";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Greeter.class);
factory.setAddress(address);
Greeter greeter = factory.create(Greeter.class);
String response = greeter.greetMe("test");
assertEquals("Get a wrong response", "Hello test", response);
}
Aggregations