use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class NettyClientTest method start.
@BeforeClass
public static void start() throws Exception {
Bus b = createStaticBus();
BusFactory.setThreadDefaultBus(b);
ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new org.apache.hello_world_soap_http.GreeterImpl());
URL wsdl = NettyClientTest.class.getResource("/wsdl/hello_world.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl);
assertNotNull("Service is null", service);
g = service.getSoapPort();
assertNotNull("Port is null", g);
}
use of org.apache.hello_world_soap_http.SOAPService 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]);
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = null;
if ("secure".equals(args[1])) {
busFile = Client.class.getResource("/SecureClient.xml");
} else if ("insecure".equals(args[1])) {
busFile = Client.class.getResource("/InsecureClient.xml");
} else {
System.out.println("arg1 needs to be either secure or insecure");
System.exit(1);
}
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
System.out.println(wsdlURL);
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
Greeter port = ss.getPort(PORT_NAME, Greeter.class);
System.out.println("Invoking greetMe...");
try {
String resp = port.greetMe(System.getProperty("user.name"));
System.out.println("Server responded with: " + resp);
System.out.println();
} catch (Exception e) {
System.out.println("Invocation failed with the following: " + e.getCause());
System.out.println();
}
System.exit(0);
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ClientNonSpring method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("please specify wsdl");
System.exit(1);
}
final 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.getPort(PORT_NAME, Greeter.class);
if ("secure".equals(args[1])) {
setupTLS(port);
} else if ("insecure".equals(args[1])) {
// do nothing
} else {
System.out.println("arg1 needs to be either secure or insecure");
System.exit(1);
}
System.out.println("Invoking greetMe...");
try {
String resp = port.greetMe(System.getProperty("user.name"));
System.out.println("Server responded with: " + resp);
System.out.println();
} catch (Exception e) {
System.out.println("Invocation failed with the following: " + e.getCause());
System.out.println();
}
System.exit(0);
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class DispatchClientServerWithHugeResponseTest method testStackOverflowErrorForSOAPMessageWithHugeResponse.
@Test
public void testStackOverflowErrorForSOAPMessageWithHugeResponse() throws Exception {
HugeResponseInterceptor hugeResponseInterceptor = new HugeResponseInterceptor(ResponseInterceptorType.overflow);
getBus().getInInterceptors().add(hugeResponseInterceptor);
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
Dispatch<SOAPMessage> disp = service.createDispatch(PORT_NAME, SOAPMessage.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
InputStream is3 = getClass().getResourceAsStream("GreetMeDocLiteralReq3.xml");
SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3);
assertNotNull(soapReqMsg3);
Response<SOAPMessage> response = disp.invokeAsync(soapReqMsg3);
try {
response.get(300, TimeUnit.SECONDS);
fail("should catch exception");
} catch (TimeoutException te) {
fail("We should not have encountered a timeout, " + "should get some exception tell me stackoverflow");
} catch (Throwable e) {
assertTrue(e.getCause() instanceof StackOverflowError);
} finally {
getBus().getInInterceptors().remove(hugeResponseInterceptor);
}
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class DispatchClientServerWithMalformedResponseTest method testSOAPMessageWithMalformedResponse.
@Test
public void testSOAPMessageWithMalformedResponse() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
Dispatch<SOAPMessage> disp = service.createDispatch(PORT_NAME, SOAPMessage.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
// Test async callback
InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3);
assertNotNull(soapReqMsg3);
TestSOAPMessageHandler tsmh = new TestSOAPMessageHandler();
Future<?> f = disp.invokeAsync(soapReqMsg3, tsmh);
assertNotNull(f);
waitForFuture(f);
assertEquals("AsyncHandler shouldn't get invoked more than once", asyncHandlerInvokedCount, 1);
}
Aggregations