Search in sources :

Example 21 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class MtomTest method setupForTest.

private void setupForTest(boolean enableClientMTOM) throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    aegisBinding.setMtomEnabled(enableClientMTOM);
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setDataBinding(aegisBinding);
    proxyFac.setAddress("http://localhost:" + PORT + "/mtom");
    JaxWsProxyFactoryBean jaxwsFac = new JaxWsProxyFactoryBean();
    jaxwsFac.setDataBinding(new AegisDatabinding());
    jaxwsFac.setAddress("http://localhost:" + PORT + "/jaxWsMtom");
    Map<String, Object> props = new HashMap<>();
    if (enableClientMTOM) {
        props.put("mtom-enabled", Boolean.TRUE);
    }
    proxyFac.setProperties(props);
    client = proxyFac.create(MtomTestService.class);
    jaxwsClient = jaxwsFac.create(MtomTestService.class);
    impl = (MtomTestImpl) applicationContext.getBean("mtomImpl");
}
Also used : HashMap(java.util.HashMap) MtomTestService(org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding)

Example 22 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class DefaultServiceBuilderFactory method newBuilder.

@Override
public ServiceBuilder newBuilder(FrontendFactory.Style s) {
    DataBinding dataBinding;
    final String dbn = getDatabindingName();
    if (ToolConstants.JAXB_DATABINDING.equals(dbn)) {
        dataBinding = new JAXBDataBinding();
    } else if (ToolConstants.AEGIS_DATABINDING.equals(dbn)) {
        dataBinding = new AegisDatabinding();
    } else {
        throw new ToolException("Unsupported databinding: " + dbn);
    }
    AbstractServiceFactory builder = null;
    if (Style.Jaxws.equals(s)) {
        builder = new JaxwsServiceBuilder();
    } else if (Style.Simple.equals(s)) {
        builder = new SimpleServiceBuilder();
    } else {
        throw new ToolException("Unsupported frontend style: " + s);
    }
    builder.setDataBinding(dataBinding);
    builder.setServiceClass(serviceClass);
    return builder;
}
Also used : AbstractServiceFactory(org.apache.cxf.frontend.AbstractServiceFactory) SimpleServiceBuilder(org.apache.cxf.simple.SimpleServiceBuilder) DataBinding(org.apache.cxf.databinding.DataBinding) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) ToolException(org.apache.cxf.tools.common.ToolException) JaxwsServiceBuilder(org.apache.cxf.jaxws.JaxwsServiceBuilder)

Example 23 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class AegisClientServerTest method testGenericPair.

@Test
public void testGenericPair() 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();
    Pair<String, Integer> ret = service.getReturnGenericPair("ffang", 111);
    assertEquals("ffang", ret.getFirst());
    assertEquals(new Integer(111), ret.getSecond());
}
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 24 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class AegisClientServerTest method testQualifiedPair.

@Test
public void testQualifiedPair() 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.getQualifiedPair(new Pair<Integer, String>(111, "ffang"));
    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 25 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class AegisJaxWsTest method setupForTest.

private void setupForTest(boolean sec) throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(AegisJaxWs.class);
    if (sec) {
        factory.setAddress("http://localhost:" + PORT + "/aegisJaxWsUN");
        WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor();
        wss4jOut.setProperty("action", "UsernameToken");
        wss4jOut.setProperty("user", "alice");
        wss4jOut.setProperty("password", "pass");
        factory.setProperties(new HashMap<String, Object>());
        factory.getProperties().put("password", "pass");
        factory.getOutInterceptors().add(wss4jOut);
    } else {
        factory.setAddress("http://localhost:" + PORT + "/aegisJaxWs");
    }
    factory.getServiceFactory().setDataBinding(new AegisDatabinding());
    client = (AegisJaxWs) factory.create();
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) WSS4JOutInterceptor(org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding)

Aggregations

AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)37 Test (org.junit.Test)21 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)14 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)12 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)10 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)7 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)7 Before (org.junit.Before)7 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)6 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)5 AegisContext (org.apache.cxf.aegis.AegisContext)4 Server (org.apache.cxf.endpoint.Server)4 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)4 HashSet (java.util.HashSet)3 ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)3 QName (javax.xml.namespace.QName)2 XFireCompatibilityServiceConfiguration (org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration)2 AuthService (org.apache.cxf.authservice.AuthService)2 Authenticate (org.apache.cxf.authservice.Authenticate)2 Service (org.apache.cxf.service.Service)2