use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class DispatchClientServerWithMalformedResponseTest method setUp.
@org.junit.Before
public void setUp() {
BusFactory.setThreadDefaultBus(getStaticBus());
BusFactory.getThreadDefaultBus().getOutInterceptors().add(new LoggingOutInterceptor());
BusFactory.getThreadDefaultBus().getInInterceptors().add(new LoggingInInterceptor());
BusFactory.getThreadDefaultBus().getInInterceptors().add(new MalformedResponseInterceptor());
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor 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.LoggingInInterceptor 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.LoggingInInterceptor in project cxf by apache.
the class InterceptorFaultTest method testRobustFailWithoutAddressingInUserLogicalPhase.
@Test
public void testRobustFailWithoutAddressingInUserLogicalPhase() throws Exception {
setupGreeter("org/apache/cxf/systest/interceptor/no-addr.xml", false);
control.setRobustInOnlyMode(true);
// behaviour is identicial for all phases
FaultLocation location = new org.apache.cxf.greeter_control.types.ObjectFactory().createFaultLocation();
location.setPhase("user-logical");
control.setFaultLocation(location);
try {
// writer to grab the content of soap fault.
// robust is not yet used at client's side, but I think it should
StringWriter writer = new StringWriter();
((Client) greeter).getInInterceptors().add(new LoggingInInterceptor(new PrintWriterEventSender(new PrintWriter(writer))));
// it should tell CXF to convert one-way robust out faults into real SoapFaultException
((Client) greeter).getEndpoint().put(Message.ROBUST_ONEWAY, true);
greeter.greetMeOneWay("oneway");
fail("Oneway operation unexpectedly succeded for phase " + location.getPhase());
} catch (SOAPFaultException ex) {
// expected
}
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor 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);
}
Aggregations