Search in sources :

Example 11 with ReflectionServiceFactoryBean

use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project jbossws-cxf by jbossws.

the class BeanCustomizer method configureEndpointFactory.

/**
 * Configure the endpoint factory
 *
 * @param factory
 */
protected void configureEndpointFactory(AbstractWSDLBasedEndpointFactory factory) {
    // Configure binding customization
    if (customization != null) {
        ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
        // customize default databinding (early pulls in ServiceFactory default databinding and configure it, as it's lazily loaded)
        serviceFactory.reset();
        DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
        configureBindingCustomization(serviceFactoryDataBinding, customization);
        serviceFactory.setDataBinding(serviceFactoryDataBinding);
        // customize user provided databinding (CXF later overrides the ServiceFactory databinding using the user provided one)
        if (factory.getDataBinding() == null) {
            // set the endpoint factory's databinding to prevent CXF resetting everything because user did not provide anything
            factory.setDataBinding(serviceFactoryDataBinding);
        } else {
            configureBindingCustomization(factory.getDataBinding(), customization);
        }
    }
// add other configurations here below
}
Also used : DataBinding(org.apache.cxf.databinding.DataBinding) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)

Example 12 with ReflectionServiceFactoryBean

use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.

the class ClientServiceConfigTest method ordinaryParamNameTest.

@Test
public void ordinaryParamNameTest() throws Exception {
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
    proxyFac.setServiceFactory(factory);
    proxyFac.setDataBinding(new AegisDatabinding());
    proxyFac.setAddress("local://Echo");
    proxyFac.setBus(getBus());
    Echo echo = proxyFac.create(Echo.class);
    String boing = echo.simpleEcho("reflection");
    assertEquals("reflection", boing);
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 13 with ReflectionServiceFactoryBean

use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.

the class DOMMappingTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    createService(DocumentService.class, "DocService");
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
    factory.getServiceConfigurations().add(0, new org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration());
    proxyFac.setServiceFactory(factory);
    proxyFac.setDataBinding(new AegisDatabinding());
    proxyFac.setAddress("local://DocService");
    proxyFac.setBus(getBus());
    Object proxyObj = proxyFac.create(IDocumentService.class);
    docClient = (IDocumentService) proxyObj;
    Client client = ClientProxy.getClient(proxyObj);
    ClientImpl clientImpl = (ClientImpl) client;
    clientImpl.setSynchronousTimeout(1000000000);
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) ClientImpl(org.apache.cxf.endpoint.ClientImpl) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Client(org.apache.cxf.endpoint.Client) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) Before(org.junit.Before)

Example 14 with ReflectionServiceFactoryBean

use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.

the class ReflectionServiceFactoryTest method testDocLiteralPartWithType.

@Test(expected = ServiceConstructionException.class)
public void testDocLiteralPartWithType() throws Exception {
    serviceFactory = new ReflectionServiceFactoryBean();
    serviceFactory.setBus(getBus());
    serviceFactory.setServiceClass(NoBodyPartsImpl.class);
    serviceFactory.getServiceConfigurations().add(0, new AbstractServiceConfiguration() {

        @Override
        public Boolean isWrapped() {
            return Boolean.FALSE;
        }

        @Override
        public Boolean isWrapped(Method m) {
            return Boolean.FALSE;
        }
    });
    Service service = serviceFactory.create();
    ServiceInfo serviceInfo = service.getServiceInfos().get(0);
    QName qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl", "operation1");
    MessageInfo mi = serviceInfo.getMessage(qname);
    qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl", "mimeAttachment");
    MessagePartInfo mpi = mi.getMessagePart(qname);
    QName elementQName = mpi.getElementQName();
    XmlSchemaElement element = serviceInfo.getXmlSchemaCollection().getElementByQName(elementQName);
    assertNotNull(element);
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) AbstractServiceConfiguration(org.apache.cxf.wsdl.service.factory.AbstractServiceConfiguration) QName(javax.xml.namespace.QName) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Service(org.apache.cxf.service.Service) Method(java.lang.reflect.Method) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo) Test(org.junit.Test)

Example 15 with ReflectionServiceFactoryBean

use of org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean in project cxf by apache.

the class CodeFirstWSDLTest method createService.

private Definition createService(Class<?> clazz) throws Exception {
    JaxWsImplementorInfo info = new JaxWsImplementorInfo(clazz);
    ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean(info);
    Bus bus = getBus();
    bean.setBus(bus);
    Service service = bean.create();
    InterfaceInfo i = service.getServiceInfos().get(0).getInterface();
    assertEquals(5, i.getOperations().size());
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setBus(bus);
    svrFactory.setServiceFactory(bean);
    svrFactory.setServiceBean(clazz.newInstance());
    svrFactory.setAddress(address);
    svrFactory.create();
    Collection<BindingInfo> bindings = service.getServiceInfos().get(0).getBindings();
    assertEquals(1, bindings.size());
    ServiceWSDLBuilder wsdlBuilder = new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
    return wsdlBuilder.build();
}
Also used : Bus(org.apache.cxf.Bus) JaxWsImplementorInfo(org.apache.cxf.jaxws.support.JaxWsImplementorInfo) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BindingInfo(org.apache.cxf.service.model.BindingInfo) Service(org.apache.cxf.service.Service) WebService(javax.jws.WebService) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) ServiceWSDLBuilder(org.apache.cxf.wsdl11.ServiceWSDLBuilder)

Aggregations

ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)21 Service (org.apache.cxf.service.Service)13 Test (org.junit.Test)11 WebService (javax.jws.WebService)9 Bus (org.apache.cxf.Bus)9 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)8 QName (javax.xml.namespace.QName)6 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)6 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)6 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)6 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)5 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)5 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)5 URL (java.net.URL)4 ServiceWSDLBuilder (org.apache.cxf.wsdl11.ServiceWSDLBuilder)4 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)4 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)3 ClientImpl (org.apache.cxf.endpoint.ClientImpl)3 BindingInfo (org.apache.cxf.service.model.BindingInfo)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)3