Search in sources :

Example 51 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class SSLNettySpringServerTest method start.

@BeforeClass
public static void start() throws Exception {
    context = new ClassPathXmlApplicationContext("/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml");
    address = "https://localhost:" + PORT + "/SoapContext/SoapPort";
    ep = context.getBean("myEndpoint", Endpoint.class);
    URL wsdl = NettyServerTest.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);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Endpoint(javax.xml.ws.Endpoint) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 52 with SOAPService

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) {
    try {
        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = Client.class.getResource("/client.xml");
        Bus bus = bf.createBus(busFile.toString());
        BusFactory.setDefaultBus(bus);
        SOAPService service = new SOAPService();
        Greeter port = service.getSoapPort();
        System.out.println("Invoking sayHi...");
        String resp = port.sayHi();
        System.out.println("Server responded with: " + resp + "\n");
        System.out.println("Invoking greetMe...");
        resp = port.greetMe(USER_NAME);
        System.out.println("Server responded with: " + resp + "\n");
        System.out.println("Invoking greetMeOneWay...");
        port.greetMeOneWay(USER_NAME);
        System.out.println("No response from server as method is OneWay\n");
        try {
            System.out.println("Invoking pingMe, expecting exception...");
            port.pingMe();
        } catch (PingMeFault ex) {
            System.out.println("Expected exception occurred: " + ex);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        System.exit(0);
    }
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) PingMeFault(org.apache.hello_world_soap_http.PingMeFault) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world_soap_http.Greeter) URL(java.net.URL)

Example 53 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class NettyHttpConduitTest method start.

@Before
public void start() throws Exception {
    Bus b = createStaticBus();
    b.setProperty(NettyHttpConduit.USE_ASYNC, NettyHttpConduitFactory.UseAsyncPolicy.ALWAYS);
    BusFactory.setThreadDefaultBus(b);
    ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new org.apache.hello_world_soap_http.GreeterImpl() {

        public String greetMeLater(long cnt) {
            // use the continuations so the async client can
            // have a ton of connections, use less threads
            // 
            // mimic a slow server by delaying somewhere between
            // 1 and 2 seconds, with a preference of delaying the earlier
            // requests longer to create a sort of backlog/contention
            // with the later requests
            ContinuationProvider p = (ContinuationProvider) getContext().getMessageContext().get(ContinuationProvider.class.getName());
            Continuation c = p.getContinuation();
            if (c.isNew()) {
                if (cnt < 0) {
                    c.suspend(-cnt);
                } else {
                    c.suspend(2000 - (cnt % 1000));
                }
                return null;
            }
            return "Hello, finally! " + cnt;
        }

        public String greetMe(String me) {
            if (me.equals(FILL_BUFFER)) {
                return String.join("", Collections.nCopies(16093, " "));
            } else {
                return "Hello " + me;
            }
        }
    });
    StringBuilder builder = new StringBuilder("NaNaNa");
    for (int x = 0; x < 50; x++) {
        builder.append(" NaNaNa ");
    }
    request = builder.toString();
    URL wsdl = NettyHttpConduitTest.class.getResource("/wsdl/hello_world_services.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService();
    assertNotNull("Service is null", service);
    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) Continuation(org.apache.cxf.continuations.Continuation) ContinuationProvider(org.apache.cxf.continuations.ContinuationProvider) Endpoint(javax.xml.ws.Endpoint) URL(java.net.URL) Before(org.junit.Before)

Example 54 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class SSLNettyClientTest method start.

@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus("/org/apache/cxf/transport/http/netty/client/integration/ServerConfig.xml");
    BusFactory.setThreadDefaultBus(b);
    address = "https://localhost:" + PORT + "/SoapContext/SoapPort";
    ep = Endpoint.publish(address, new org.apache.hello_world_soap_http.GreeterImpl());
    URL wsdl = SSLNettyClientTest.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);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 55 with SOAPService

use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.

the class AsyncHTTPConduitTest method start.

@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus();
    b.setProperty(AsyncHTTPConduit.USE_ASYNC, AsyncHTTPConduitFactory.UseAsyncPolicy.ALWAYS);
    b.setProperty("org.apache.cxf.transport.http.async.MAX_CONNECTIONS", 501);
    BusFactory.setThreadDefaultBus(b);
    AsyncHTTPConduitFactory hcf = (AsyncHTTPConduitFactory) b.getExtension(HTTPConduitFactory.class);
    assertEquals(501, hcf.getMaxConnections());
    ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new org.apache.hello_world_soap_http.GreeterImpl() {

        public String greetMeLater(long cnt) {
            // use the continuations so the async client can
            // have a ton of connections, use less threads
            // 
            // mimic a slow server by delaying somewhere between
            // 1 and 2 seconds, with a preference of delaying the earlier
            // requests longer to create a sort of backlog/contention
            // with the later requests
            ContinuationProvider p = (ContinuationProvider) getContext().getMessageContext().get(ContinuationProvider.class.getName());
            Continuation c = p.getContinuation();
            if (c.isNew()) {
                if (cnt < 0) {
                    c.suspend(-cnt);
                } else {
                    c.suspend(2000 - (cnt % 1000));
                }
                return null;
            }
            return "Hello, finally! " + cnt;
        }

        public String greetMe(String me) {
            if (me.equals(FILL_BUFFER)) {
                return String.join("", Collections.nCopies(16093, " "));
            } else {
                return "Hello " + me;
            }
        }
    });
    StringBuilder builder = new StringBuilder("NaNaNa");
    for (int x = 0; x < 50; x++) {
        builder.append(" NaNaNa ");
    }
    request = builder.toString();
    URL wsdl = AsyncHTTPConduitTest.class.getResource("/wsdl/hello_world_services.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService();
    assertNotNull("Service is null", service);
    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) Continuation(org.apache.cxf.continuations.Continuation) HTTPConduitFactory(org.apache.cxf.transport.http.HTTPConduitFactory) ContinuationProvider(org.apache.cxf.continuations.ContinuationProvider) Endpoint(javax.xml.ws.Endpoint) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Aggregations

SOAPService (org.apache.hello_world_soap_http.SOAPService)84 URL (java.net.URL)67 Test (org.junit.Test)56 Greeter (org.apache.hello_world_soap_http.Greeter)49 InputStream (java.io.InputStream)20 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)18 SOAPMessage (javax.xml.soap.SOAPMessage)14 Bus (org.apache.cxf.Bus)14 BindingProvider (javax.xml.ws.BindingProvider)13 Endpoint (javax.xml.ws.Endpoint)13 SOAPServiceBogusAddressTest (org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest)13 SOAPServiceMultiPortTypeTest (org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest)13 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)12 TimeoutException (java.util.concurrent.TimeoutException)8 WebServiceException (javax.xml.ws.WebServiceException)8 File (java.io.File)7 ExecutionException (java.util.concurrent.ExecutionException)7 QName (javax.xml.namespace.QName)7 BeforeClass (org.junit.BeforeClass)7 GreetMeLaterResponse (org.apache.hello_world_soap_http.types.GreetMeLaterResponse)6