Search in sources :

Example 16 with LoggingInInterceptor

use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.

the class AegisClientServerTest method testReturnGenericPair.

@Test
public void testReturnGenericPair() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    int ret = service.getGenericPair(new Pair<Integer, String>(111, "String"));
    assertEquals(111, ret);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 17 with LoggingInInterceptor

use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.

the class AegisClientServerTest method testGenericCollection.

@Test
public void testGenericCollection() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    List<String> list = new ArrayList<>();
    list.add("ffang");
    String ret = service.getGeneric(list);
    assertEquals(ret, "ffang");
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ArrayList(java.util.ArrayList) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 18 with LoggingInInterceptor

use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.

the class AegisClientServerTest method testCollection.

@Test
public void testCollection() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setWsdlLocation("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    Collection<Team> teams = service.getTeams();
    assertEquals(1, teams.size());
    assertEquals("Patriots", teams.iterator().next().getName());
    // CXF-1251
    String s = service.testForMinOccurs0("A", null, "b");
    assertEquals("Anullb", s);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 19 with LoggingInInterceptor

use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.

the class MultipleServiceShareClassTest method createGetterService.

private <T extends Getter> T createGetterService(final Class<T> serviceClass) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("http://localhost:" + PORT + "/" + serviceClass.getSimpleName());
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    return factory.create(serviceClass);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor)

Example 20 with LoggingInInterceptor

use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.

the class SpringBeansTest method testClientFromFactory.

@Test
public void testClientFromFactory() throws Exception {
    AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "/org/apache/cxf/jaxws/spring/clients.xml" });
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    Greeter g = factory.create(Greeter.class);
    ClientImpl c = (ClientImpl) ClientProxy.getClient(g);
    for (Interceptor<? extends Message> i : c.getInInterceptors()) {
        if (i instanceof LoggingInInterceptor) {
            ctx.close();
            return;
        }
    }
    ctx.close();
    fail("Did not configure the client");
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Greeter(org.apache.hello_world_soap_http.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ClientImpl(org.apache.cxf.endpoint.ClientImpl) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Test(org.junit.Test)

Aggregations

LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)220 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)207 Test (org.junit.Test)177 Service (org.apache.cxf.service.Service)138 Client (org.apache.cxf.endpoint.Client)135 HashMap (java.util.HashMap)100 WSSSecurityProperties (org.apache.wss4j.stax.ext.WSSSecurityProperties)89 ArrayList (java.util.ArrayList)67 Properties (java.util.Properties)65 WSSConstants (org.apache.wss4j.stax.ext.WSSConstants)61 QName (javax.xml.namespace.QName)32 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)23 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)19 AbstractSecurityTest (org.apache.cxf.ws.security.wss4j.AbstractSecurityTest)18 Echo (org.apache.cxf.ws.security.wss4j.Echo)18 URL (java.net.URL)14 Bus (org.apache.cxf.Bus)14 Server (org.apache.cxf.endpoint.Server)14 Greeter (org.apache.cxf.greeter_control.Greeter)14 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)13