use of org.apache.cxf.interceptor.LoggingOutInterceptor in project camel by apache.
the class CXFWsdlOnlyPayloadModeNoSpringTest method testRoutes.
@Test
public void testRoutes() throws Exception {
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, QName.valueOf(getServiceName()));
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/" + getClass().getSimpleName() + "/PersonService");
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
Holder<String> personId = new Holder<String>();
personId.value = "hello";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
client.getPerson(personId, ssn, name);
assertEquals("Bonjour", name.value);
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project camel by apache.
the class CxfConsumerPayloadFaultCauseEnabledTest method testInvokingFromCxfClient.
@Test
public void testInvokingFromCxfClient() throws Exception {
this.getCamelContextService();
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, SERVICE_QNAME);
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceAddress);
Holder<String> personId = new Holder<String>();
personId.value = "";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
try {
client.getPerson(personId, ssn, name);
fail("SOAPFault expected!");
} catch (Exception e) {
assertTrue(e instanceof SOAPFaultException);
SOAPFault fault = ((SOAPFaultException) e).getFault();
assertEquals("Someone messed up the service. Caused by: Homer", fault.getFaultString());
}
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project camel by apache.
the class CxfConsumerPayloadFaultTest method testInvokingFromCxfClient.
@Test
public void testInvokingFromCxfClient() throws Exception {
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, QName.valueOf(SERVICE_NAME));
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceAddress);
Holder<String> personId = new Holder<String>();
personId.value = "";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
Throwable t = null;
try {
client.getPerson(personId, ssn, name);
fail("expect UnknownPersonFault");
} catch (UnknownPersonFault e) {
t = e;
assertEquals("Get the wrong fault detail", "", e.getFaultInfo().getPersonId());
}
assertNotNull(t);
assertTrue(t instanceof UnknownPersonFault);
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project camel by apache.
the class CxfRsProducerClientFactoryBeanTest method testProducerInOutInterceptors.
@Test
public void testProducerInOutInterceptors() throws Exception {
CxfRsEndpoint e = context.getEndpoint("cxfrs://bean://rsClientHttpInterceptors", CxfRsEndpoint.class);
CxfRsProducer p = new CxfRsProducer(e);
CxfRsProducer.ClientFactoryBeanCache cache = p.getClientFactoryBeanCache();
JAXRSClientFactoryBean bean = cache.get("http://localhost:8080/CxfRsProducerClientFactoryBeanInterceptors/");
List<Interceptor<?>> ins = bean.getInInterceptors();
assertEquals(1, ins.size());
assertTrue(ins.get(0) instanceof LoggingInInterceptor);
List<Interceptor<?>> outs = bean.getOutInterceptors();
assertEquals(1, outs.size());
assertTrue(outs.get(0) instanceof LoggingOutInterceptor);
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project qi4j-sdk by Qi4j.
the class HelloClient method main.
public static void main(String[] args) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
factory.setAddress("http://localhost:9001/helloWorld");
HelloWorld client = (HelloWorld) factory.create();
String reply = client.sayHi("World");
System.out.println("Server said: " + reply);
}
Aggregations