use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.
the class NumberFactoryImpl method initDefaultServant.
protected void initDefaultServant() {
servant = new NumberImpl();
String wsdlLocation = "testutils/factory_pattern.wsdl";
String bindingId = null;
EndpointImpl ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation);
ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort"));
ep.publish(getServantAddressRoot());
endpoints.add(ep);
templateEpr = ep.getServer().getDestination().getAddress();
// jms port
EmbeddedJMSBrokerLauncher.updateWsdlExtensors(bus, wsdlLocation);
ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation);
ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPortJMS"));
ep.setAddress("jms:jndi:dynamicQueues/test.cxf.factory_pattern.queue");
ep.publish();
ep.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
ep.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
endpoints.add(ep);
}
use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.
the class IntFaultClientServerTest method testBasicConnection.
@Test
public void testBasicConnection() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world_fault.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull("Service is null", service);
Greeter greeter = service.getSoapPort();
ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
updateAddressPort(greeter, PORT);
try {
greeter.testDocLitFault("fault");
} catch (BadRecordLitFault e) {
assertEquals(5, e.getFaultInfo());
assertSoapHeader((BindingProvider) greeter);
}
}
use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.
the class ClientMtomXopTest method createPort.
private <T> T createPort(QName serviceName, QName portName, Class<T> serviceEndpointInterface, boolean enableMTOM, boolean installInterceptors) throws Exception {
ReflectionServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
Bus bus = getStaticBus();
serviceFactory.setBus(bus);
serviceFactory.setServiceName(serviceName);
serviceFactory.setServiceClass(serviceEndpointInterface);
serviceFactory.setWsdlURL(ClientMtomXopTest.class.getResource("/wsdl/mtom_xop.wsdl"));
Service service = serviceFactory.create();
EndpointInfo ei = service.getEndpointInfo(portName);
JaxWsEndpointImpl jaxwsEndpoint = new JaxWsEndpointImpl(bus, service, ei);
SOAPBinding jaxWsSoapBinding = new SOAPBindingImpl(ei.getBinding(), jaxwsEndpoint);
jaxWsSoapBinding.setMTOMEnabled(enableMTOM);
if (installInterceptors) {
// jaxwsEndpoint.getBinding().getInInterceptors().add(new TestMultipartMessageInterceptor());
jaxwsEndpoint.getBinding().getOutInterceptors().add(new TestAttachmentOutInterceptor());
}
jaxwsEndpoint.getBinding().getInInterceptors().add(new LoggingInInterceptor());
jaxwsEndpoint.getBinding().getOutInterceptors().add(new LoggingOutInterceptor());
Client client = new ClientImpl(bus, jaxwsEndpoint);
InvocationHandler ih = new JaxWsClientProxy(client, jaxwsEndpoint.getJaxwsBinding());
Object obj = Proxy.newProxyInstance(serviceEndpointInterface.getClassLoader(), new Class[] { serviceEndpointInterface, BindingProvider.class }, ih);
updateAddressPort(obj, PORT);
return serviceEndpointInterface.cast(obj);
}
use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.
the class DecoupledClientServerOnewayTest method testDecoupledOneway.
@Test
public void testDecoupledOneway() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("/org/apache/cxf/systest/ws/rm/exactlyonce-inorder-decoupled.xml");
BusFactory.setDefaultBus(bus);
LoggingInInterceptor in = new LoggingInInterceptor();
in.setPrettyLogging(true);
bus.getInInterceptors().add(in);
bus.getInFaultInterceptors().add(in);
LoggingOutInterceptor out = new LoggingOutInterceptor();
out.setPrettyLogging(true);
bus.getOutInterceptors().add(out);
bus.getOutFaultInterceptors().add(out);
GreeterService gs = new GreeterService();
final Greeter greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
((BindingProvider) greeter).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
LOG.fine("Created greeter client.");
ConnectionHelper.setKeepAliveConnection(greeter, true);
greeter.greetMeOneWay("oneway");
}
use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.
the class RetransmissionQueueTest method testDecoupleFaultHandling.
@Test
public void testDecoupleFaultHandling() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("/org/apache/cxf/systest/ws/rm/message-loss.xml");
BusFactory.setDefaultBus(bus);
LoggingInInterceptor in = new LoggingInInterceptor();
bus.getInInterceptors().add(in);
bus.getInFaultInterceptors().add(in);
LoggingOutInterceptor out = new LoggingOutInterceptor();
bus.getOutInterceptors().add(out);
bus.getExtension(RMManager.class).getConfiguration().setBaseRetransmissionInterval(new Long(4000));
// an interceptor to simulate a transmission error
MessageLossSimulator loser = new MessageLossSimulator();
bus.getOutInterceptors().add(loser);
bus.getOutFaultInterceptors().add(out);
GreeterService gs = new GreeterService();
final Greeter greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
LOG.fine("Created greeter client.");
ConnectionHelper.setKeepAliveConnection(greeter, true);
loser.setMode(-1);
loser.setThrowsException(true);
try {
greeter.greetMeOneWay("oneway");
} catch (Exception e) {
fail("fault thrown after queued for retransmission");
}
Thread.sleep(2000);
RMManager manager = bus.getExtension(RMManager.class);
boolean empty = manager.getRetransmissionQueue().isEmpty();
assertFalse("RetransmissionQueue is empty", empty);
loser.setMode(1);
Thread.sleep(6000);
empty = manager.getRetransmissionQueue().isEmpty();
assertTrue("RetransmissionQueue not cleared", empty);
}
Aggregations