Search in sources :

Example 1 with GreeterImpl

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

the class CxfPayloadProviderRouterTest method startService.

@BeforeClass
public static void startService() {
    implementor = new GreeterImpl();
    String address = "http://localhost:" + CXFTestSupport.getPort1() + "/CxfPayLoadProviderRouterTest/SoapContext/SoapPort";
    endpoint = Endpoint.publish(address, implementor);
}
Also used : GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) BeforeClass(org.junit.BeforeClass)

Example 2 with GreeterImpl

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

the class WSAddressingTest method setUp.

@Before
public void setUp() throws Exception {
    template = context.createProducerTemplate();
    JaxWsServerFactoryBean svrBean = new JaxWsServerFactoryBean();
    svrBean.setAddress(getServerAddress());
    svrBean.setServiceClass(Greeter.class);
    svrBean.setServiceBean(new GreeterImpl());
    SpringBusFactory bf = new SpringBusFactory();
    URL cxfConfig = null;
    if (getCxfServerConfig() != null) {
        cxfConfig = ClassLoaderUtils.getResource(getCxfServerConfig(), this.getClass());
    }
    svrBean.setBus(bf.createBus(cxfConfig));
    serviceEndpoint = svrBean.create();
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) URL(java.net.URL) Before(org.junit.Before)

Example 3 with GreeterImpl

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

the class CxfPayloadProviderRouterTest method startService.

@BeforeClass
public static void startService() {
    implementor = new GreeterImpl();
    String address = "http://localhost:" + getPort1() + "/CxfPayLoadProviderRouterTest/SoapContext/SoapPort";
    endpoint = Endpoint.publish(address, implementor);
}
Also used : GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) BeforeClass(org.junit.BeforeClass)

Example 4 with GreeterImpl

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

the class EndpointImplTest method testEndpointServiceConstructor.

@Test
public void testEndpointServiceConstructor() throws Exception {
    GreeterImpl greeter = new GreeterImpl();
    JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
    serviceFactory.setBus(getBus());
    serviceFactory.setInvoker(new BeanInvoker(greeter));
    serviceFactory.setServiceClass(GreeterImpl.class);
    try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, new JaxWsServerFactoryBean(serviceFactory))) {
        WebServiceContext ctx = greeter.getContext();
        assertNull(ctx);
        try {
            String address = "http://localhost:8080/test";
            endpoint.publish(address);
        } catch (IllegalArgumentException ex) {
            assertTrue(ex.getCause() instanceof BusException);
            assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException) ex.getCause()).getCode());
        }
        ctx = greeter.getContext();
        assertNotNull(ctx);
    }
}
Also used : JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BeanInvoker(org.apache.cxf.service.invoker.BeanInvoker) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) WebServiceContext(javax.xml.ws.WebServiceContext) BusException(org.apache.cxf.BusException) Test(org.junit.Test)

Example 5 with GreeterImpl

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

the class GreeterTest method testEndpoint.

@Test
public void testEndpoint() throws Exception {
    ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(resource);
    bean.setWsdlURL(resource.toString());
    bean.setBus(bus);
    bean.setServiceClass(GreeterImpl.class);
    GreeterImpl greeter = new GreeterImpl();
    BeanInvoker invoker = new BeanInvoker(greeter);
    Service service = bean.create();
    assertEquals("SOAPService", service.getName().getLocalPart());
    assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());
    ServerFactoryBean svr = new ServerFactoryBean();
    svr.setBus(bus);
    svr.setServiceFactory(bean);
    svr.setInvoker(invoker);
    svr.create();
    Node response = invoke("http://localhost:9000/SoapContext/SoapPort", LocalTransportFactory.TRANSPORT_ID, "GreeterMessage.xml");
    assertEquals(1, greeter.getInvocationCount());
    assertNotNull(response);
    addNamespace("h", "http://apache.org/hello_world_soap_http/types");
    assertValid("/s:Envelope/s:Body", response);
    assertValid("//h:sayHiResponse", response);
}
Also used : JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BeanInvoker(org.apache.cxf.service.invoker.BeanInvoker) Node(org.w3c.dom.Node) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) Service(org.apache.cxf.service.Service) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) URL(java.net.URL) Test(org.junit.Test)

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