use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.
the class DispatchTest method testInterceptorsConfiguration.
@Test
public // CXF-2822
void testInterceptorsConfiguration() throws Exception {
String cfgFile = "org/apache/cxf/jaxws/dispatch/bus-dispatch.xml";
Bus bus = new SpringBusFactory().createBus(cfgFile, true);
ServiceImpl service = new ServiceImpl(bus, getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
List<Interceptor<? extends Message>> interceptors = ((DispatchImpl<?>) disp).getClient().getInInterceptors();
boolean exists = false;
for (Interceptor<? extends Message> interceptor : interceptors) {
if (interceptor instanceof LoggingInInterceptor) {
exists = true;
}
}
assertTrue("The LoggingInInterceptor is not configured to dispatch client", exists);
}
use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.
the class DispatchTest method testDOMSource.
@Test
public void testDOMSource() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
DOMSource source = new DOMSource(doc);
Source res = disp.invoke(source);
assertNotNull(res);
}
use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.
the class DispatchTest method testSOAPPBinding.
@Test
public void testSOAPPBinding() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), null, SERVICE_NAME, null);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "local://foobar");
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
assertTrue(disp.getBinding() instanceof SOAPBinding);
}
use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.
the class DispatchTest method testHTTPBinding.
@Test
public void testHTTPBinding() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), null, SERVICE_NAME, null);
service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, "local://foobar");
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
assertTrue(disp.getBinding() instanceof HTTPBinding);
}
use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.
the class DispatchTest method testFindOperationWithSource.
@Test
public void testFindOperationWithSource() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
disp.getRequestContext().put("find.dispatch.operation", Boolean.TRUE);
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
BindingOperationVerifier bov = new BindingOperationVerifier();
((DispatchImpl<?>) disp).getClient().getOutInterceptors().add(bov);
Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
DOMSource source = new DOMSource(doc);
Source res = disp.invoke(source);
assertNotNull(res);
BindingOperationInfo boi = bov.getBindingOperationInfo();
assertNotNull(boi);
assertEquals(new QName("http://apache.org/hello_world_soap_http", "sayHi"), boi.getName());
}
Aggregations