Search in sources :

Example 11 with GreeterImpl

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

the class NoSpringServletServer method run.

@Override
protected void run() {
    // setup the system properties
    String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
    System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
    try {
        httpServer = new Server(Integer.parseInt(PORT));
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        httpServer.setHandler(contexts);
        ServletContextHandler root = new ServletContextHandler(contexts, "/", ServletContextHandler.SESSIONS);
        bus = BusFactory.getDefaultBus(true);
        CXFServlet cxf = new CXFServlet();
        cxf.setBus(bus);
        ServletHolder servlet = new ServletHolder(cxf);
        servlet.setName("soap");
        servlet.setForcedPath("soap");
        root.addServlet(servlet, "/soap/*");
        httpServer.start();
        setBus(bus);
        BusFactory.setDefaultBus(bus);
        GreeterImpl impl = new GreeterImpl();
        Endpoint.publish("/Greeter", impl);
        HelloImpl helloImpl = new HelloImpl();
        Endpoint.publish("/Hello", helloImpl);
        ((EndpointImpl) Endpoint.create(helloImpl)).publish("/");
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        // clean up the system properties
        if (busFactory != null) {
            System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, busFactory);
        } else {
            System.clearProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
        }
    }
}
Also used : Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) CXFServlet(org.apache.cxf.transport.servlet.CXFServlet) ContextHandlerCollection(org.eclipse.jetty.server.handler.ContextHandlerCollection) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Example 12 with GreeterImpl

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

the class Server method run.

protected void run() {
    URL url = getClass().getResource("fault-stack-trace.xml");
    if (url != null) {
        System.setProperty("cxf.config.file.url", url.toString());
    }
    Object implementor;
    String address;
    implementor = new AsyncGreeter();
    address = "http://localhost:" + PORT + "/SoapContext/AsyncSoapPort";
    eps.add(Endpoint.publish(address, implementor));
    implementor = new AsyncEchoProvider();
    address = "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider";
    eps.add(Endpoint.publish(address, implementor));
    implementor = new GreeterImplMultiPort();
    address = "http://localhost:" + PORT + "/MultiPort/GreeterPort";
    eps.add(Endpoint.publish(address, implementor));
    implementor = new DocLitBareGreeterMultiPort();
    address = "http://localhost:" + PORT + "/MultiPort/DocBarePort";
    eps.add(Endpoint.publish(address, implementor));
    implementor = new GreeterImpl();
    address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    Endpoint ep = Endpoint.publish(address, implementor);
    eps.add(ep);
    implementor = new GreeterImpl();
    address = "http://localhost:" + PORT + "/SoapContext/SoapPortWithGzip";
    Endpoint ep2 = Endpoint.publish(address, implementor);
    ((EndpointImpl) ep2).getService().getInInterceptors().add(new GZIPInInterceptor());
    ((EndpointImpl) ep2).getService().getOutInterceptors().add(new GZIPOutInterceptor());
    eps.add(ep2);
    implementor = new RefGreeterImpl();
    address = "http://localhost:" + PORT + "/SoapContext/SoapPort2";
    eps.add(Endpoint.publish(address, implementor));
    // publish port with soap12 binding
    address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    EndpointImpl e = (EndpointImpl) Endpoint.create(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING, new Greeter12Impl());
    e.publish(address);
    eps.add(e);
    implementor = new DocLitBareGreeterImpl();
    address = "http://localhost:" + BARE_PORT + "/SoapContext/SoapPort";
    eps.add(Endpoint.publish(address, implementor));
    implementor = new GreeterImplBogus();
    address = "http://localhost:" + BOGUS_REAL_PORT + "/SoapContext/SoapPort";
    eps.add(Endpoint.publish(address, implementor));
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) GZIPInInterceptor(org.apache.cxf.transport.common.gzip.GZIPInInterceptor) URL(java.net.URL) GZIPOutInterceptor(org.apache.cxf.transport.common.gzip.GZIPOutInterceptor) Endpoint(javax.xml.ws.Endpoint) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) BaseGreeterImpl(org.apache.hello_world_soap_http.BaseGreeterImpl) DocLitBareGreeterImpl(org.apache.hello_world_soap_http.DocLitBareGreeterImpl) DocLitBareGreeterImpl(org.apache.hello_world_soap_http.DocLitBareGreeterImpl)

Example 13 with GreeterImpl

use of org.apache.hello_world_soap_http.GreeterImpl in project camel by apache.

the class CxfProducerSoapFaultTest method startService.

@BeforeClass
public static void startService() throws Exception {
    GreeterImpl greeterImpl = new GreeterImpl();
    Endpoint.publish(JAXWS_SERVER_ADDRESS, greeterImpl);
}
Also used : GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) BeforeClass(org.junit.BeforeClass)

Example 14 with GreeterImpl

use of org.apache.hello_world_soap_http.GreeterImpl in project camel by apache.

the class CxfProducerTest method startService.

@Before
public void startService() throws Exception {
    // start a simple front service
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress(getSimpleServerAddress());
    svrBean.setServiceClass(HelloService.class);
    svrBean.setServiceBean(new HelloServiceImpl());
    svrBean.setBus(BusFactory.getDefaultBus());
    server = svrBean.create();
    GreeterImpl greeterImpl = new GreeterImpl();
    endpoint = Endpoint.publish(getJaxWsServerAddress(), greeterImpl);
}
Also used : GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) Before(org.junit.Before)

Example 15 with GreeterImpl

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

the class WSAFeatureXmlTest method testServerFactory.

@Test
public void testServerFactory() {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    assertNotNull(bus != null);
    sf.setServiceBean(new GreeterImpl());
    sf.setAddress("http://localhost:" + PORT + "/test");
    sf.setStart(false);
    Configurer c = getBus().getExtension(Configurer.class);
    c.configureBean("server", sf);
    Server server = sf.create();
    Endpoint endpoint = server.getEndpoint();
    checkAddressInterceptors(endpoint.getInInterceptors());
}
Also used : Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) Configurer(org.apache.cxf.configuration.Configurer) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest)

Aggregations

GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)28 Test (org.junit.Test)17 URL (java.net.URL)7 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)7 InputStream (java.io.InputStream)6 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)6 Document (org.w3c.dom.Document)6 EndpointReference (javax.xml.ws.EndpointReference)5 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)5 ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)5 BusException (org.apache.cxf.BusException)4 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)4 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)4 Service (org.apache.cxf.service.Service)4 QName (javax.xml.namespace.QName)3 DOMSource (javax.xml.transform.dom.DOMSource)3 WebServiceContext (javax.xml.ws.WebServiceContext)3 WebServiceFeature (javax.xml.ws.WebServiceFeature)3 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)3 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)3