Package org.codehaus.xfire.service.binding

Examples of org.codehaus.xfire.service.binding.ObjectServiceFactory


        tm = (TypeMappingRegistry) KNOWN_TYPE_MAPPINGS.get(selectedTypeMapping);
        if (tm == null) {
            throw new Exception("Unrecognized typeMapping: " + typeMapping);
        }
        // Create factory
        ObjectServiceFactory factory = null;
        if (wa == null) {
            factory = new ObjectServiceFactory(xfire.getTransportManager(),
                                               new AegisBindingProvider(tm));
        } else if (selectedAnnotations.equals(AN_JAVA5)
                   && selectedTypeMapping.equals(TM_JAXB2)) {
            try {
                factory = new JAXWSServiceFactory(xfire.getTransportManager());
            } catch (Exception e) {
                factory = new AnnotationServiceFactory(wa,
                        xfire.getTransportManager(),
                        new AegisBindingProvider(tm));
            }
        } else {
            factory = new AnnotationServiceFactory(wa,
                                                   xfire.getTransportManager(),
                                                   new AegisBindingProvider(tm));
        }
        // Register only JBI transport in the factory
        factory.getSoap11Transports().clear();
        factory.getSoap12Transports().clear();
        factory.getSoap11Transports().add(JbiTransport.JBI_BINDING);
        return factory;
    }
View Full Code Here


   * @param api the api exposed to the client
   */
  public Object createProxy(Class api)
  {
    try {
      Service service = new ObjectServiceFactory().create(api);

      return new XFireProxyFactory().create(service, _url);
    }
    catch (Exception e) {
      throw ConfigException.create(e);
View Full Code Here

  public void init(ServletConfig servletConfig)
    throws ServletException
  {
    super.init(servletConfig);
    ObjectServiceFactory factory =
      new ObjectServiceFactory(getXFire().getTransportManager(), null);
    factory.addIgnoredMethods("java.lang.Comparable");
    Service service = factory.create(_serviceClass);
    service.setInvoker(new BeanInvoker(_instance));
    getController().getServiceRegistry().register(service);
  }
View Full Code Here

   
    public Service buildService(){

        if (serviceFactory == null)
        {
            serviceFactory = new ObjectServiceFactory(xFire.getTransportManager(),
                                                      new AegisBindingProvider());
        }

        /**
         * Use the ServiceInterface if that is set, otherwise use the Class of
         * the service object.
         */
        final Class intf = getServiceClass();
        // Lets set up some properties for the service
        final Map properties = new HashMap();
        properties.put(ObjectServiceFactory.SOAP_VERSION, soapVersion);
       
        if (style != null)
            properties.put(ObjectServiceFactory.STYLE, style);
        if (use != null)
            properties.put(ObjectServiceFactory.USE, use);
       
        if (implementationClass != null)
        {
            properties.put(ObjectInvoker.SERVICE_IMPL_CLASS, implementationClass);
        }
       
        // Set the properties
        copyProperties(properties);
       
        final Service xfireService = serviceFactory.create(intf, name, namespace, properties);

        // Register the service
        xFire.getServiceRegistry().register(xfireService);
       
        // If we're referencing a proxy via a Factory, which may be lazy,
        // set up our invoker using the factory.
        final Factory servant = getServant();
        if (servant != null) {
            xfireService.setInvoker(new FactoryInvoker(servant, scope));
        }

        if (schemas != null)
        {
            ObjectServiceFactory osf = (ObjectServiceFactory) serviceFactory;
           
            DefaultWSDLBuilderFactory wbf =
                (DefaultWSDLBuilderFactory) osf.getWsdlBuilderFactory();
            wbf.setSchemaLocations(schemas);
        }

        // set up in handlers
        if (xfireService.getInHandlers() == null)
View Full Code Here

        tm = (TypeMappingRegistry) knownTypeMappings.get(selectedTypeMapping);
        if (tm == null) {
            throw new Exception("Unrecognized typeMapping: " + typeMapping);
        }
        // Create factory
        ObjectServiceFactory factory = null;
        if (wa == null) {
            factory = new ObjectServiceFactory(xfire.getTransportManager(),
                                               new AegisBindingProvider(tm));
        } else if (selectedAnnotations.equals(AN_JAVA5) &&
                   selectedTypeMapping.equals(TM_JAXB2)) {
            try {
                Class clazz = Class.forName("org.codehaus.xfire.jaxws.JAXWSServiceFactory");
                Constructor ct = clazz.getDeclaredConstructor(new Class[] { TransportManager.class });
                factory = (ObjectServiceFactory) ct.newInstance(new Object[] { xfire.getTransportManager() });
            } catch (Exception e) {
                factory = new AnnotationServiceFactory(wa,
                        xfire.getTransportManager(),
                        new AegisBindingProvider(tm));
            }
        } else {
            factory = new AnnotationServiceFactory(wa,
                                                   xfire.getTransportManager(),
                                                   new AegisBindingProvider(tm));
        }
        // Register only JBI transport in the factory
        factory.getSoap11Transports().clear();
        factory.getSoap12Transports().clear();
        factory.getSoap11Transports().add(JbiTransport.JBI_BINDING);
        return factory;
    }
View Full Code Here

            Class cl = Class.forName(pojoClass, true, classLoader);
            pojo = cl.newInstance();
        }
        // Create factory
        XFire xfire = getXFire();
        ObjectServiceFactory factory = ServiceFactoryHelper.findServiceFactory(xfire, pojo.getClass(), annotations, typeMapping);
        Class serviceClass = pojo.getClass();
        if (serviceInterface != null) {
            serviceClass = Class.forName(serviceInterface);
        }

        this.definition = loadDefinition();
        if (definition != null) {
            if (definition.getServices().size() != 1) {
                throw new InvalidParameterException("The deployed wsdl defines more than one service");
            }
            javax.wsdl.Service wsdlSvc = (javax.wsdl.Service) definition.getServices().values().iterator().next();
            if (service == null) {
                service = wsdlSvc.getQName();
            } else if (!service.equals(wsdlSvc.getQName())) {
                throw new InvalidParameterException("The name of the Service defined by the deployed wsdl does not match the service name of the jbi endpoint");
            }
            if (wsdlSvc.getPorts().size() != 1) {
                throw new InvalidParameterException("The Service defined in the deployed wsdl must define exactly one Port");
            }
            Port wsdlPort = (Port) wsdlSvc.getPorts().values().iterator().next();
            if (endpoint == null) {
                endpoint = wsdlPort.getName();
            } else if (!endpoint.equals(wsdlPort.getName())) {
                throw new InvalidParameterException("The name of the Port defined by the deployed wsdl does not match the endpoint name of the jbi endpoint");
            }
            Binding wsdlBinding = wsdlPort.getBinding();
            if (wsdlBinding == null) {
                throw new InvalidParameterException("The Port defined in the deployed wsdl does not have any binding");
            }
            PortType wsdlPortType = wsdlBinding.getPortType();
            if (wsdlPortType == null) {
                throw new InvalidParameterException("The Binding defined in the deployed wsdl does not have reference a PortType");
            }
            if (interfaceName == null) {
                interfaceName = wsdlPortType.getQName();
            } else if (!interfaceName.equals(wsdlPortType.getQName())) {
                throw new InvalidParameterException("The name of the PortType defined by the deployed wsdl does not match the interface name of the jbi endpoint");
            }
            // Create the DOM document
            description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
        }
       
        String svcLocalName = (service != null) ? service.getLocalPart() : null;
        String svcNamespace;
        if (interfaceName != null) {
            svcNamespace = interfaceName.getNamespaceURI();
        } else if (service != null) {
            svcNamespace = service.getNamespaceURI();
        } else {
            svcNamespace = null;
        }
        Map props = new HashMap();
        props.put(ObjectServiceFactory.PORT_TYPE, interfaceName);
        if (style != null) {
            props.put(ObjectServiceFactory.STYLE, style);
        }
        props.put(ObjectServiceFactory.USE, SoapConstants.USE_LITERAL);
        if (serviceInterface != null) {
            props.put("annotations.allow.interface", "true");
        }
        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
        xfireService.setInvoker(new BeanInvoker(getPojo()));
        xfireService.setFaultSerializer(new JbiFaultSerializer(getConfiguration()));
        xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
        xfire.getServiceRegistry().register(xfireService);
       
View Full Code Here

    }
   
    public void init(ComponentContext context) throws JBIException {
        super.init(context);
        xfire = new DefaultXFire();
        ObjectServiceFactory factory = new ObjectServiceFactory(xfire.getTransportManager(),
                                                                new AegisBindingProvider());
        factory.setVoidOneWay(true);
        factory.setStyle(SoapConstants.STYLE_DOCUMENT);
        if (isDefaultInOut()) {
            service = factory.create(InOutService.class);
            service.setInvoker(new BeanInvoker(new InOutService(this)));
        } else {
            service = factory.create(InOnlyService.class);
            service.setInvoker(new BeanInvoker(new InOnlyService(this)));
        }
        xfire.getServiceRegistry().register(service);
        controller = new Controller(xfire);
        transformer = new SourceTransformer();
View Full Code Here

    }
   
    public void init(ComponentContext context) throws JBIException {
        super.init(context);
        xfire = new DefaultXFire();
        ObjectServiceFactory factory = new ObjectServiceFactory(xfire.getTransportManager(),
                                                                new AegisBindingProvider());
        factory.setVoidOneWay(true);
        factory.setStyle(SoapConstants.STYLE_DOCUMENT);
        if (isDefaultInOut()) {
            service = factory.create(InOutService.class);
            service.setInvoker(new BeanInvoker(new InOutService(this)));
        } else {
            service = factory.create(InOnlyService.class);
            service.setInvoker(new BeanInvoker(new InOnlyService(this)));
        }
        xfire.getServiceRegistry().register(service);
        controller = new Controller(xfire);
        transformer = new SourceTransformer();
View Full Code Here

            Class cl = Class.forName(pojoClass, true, getServiceUnit().getConfigurationClassLoader());
            pojo = cl.newInstance();
        }
        // Create factory
        XFire xfire = getXFire();
        ObjectServiceFactory factory = ServiceFactoryHelper.findServiceFactory(xfire, pojo.getClass(), annotations, typeMapping);
        Class serviceClass = pojo.getClass();
        if (serviceInterface != null) {
            serviceClass = Class.forName(serviceInterface, true, getServiceUnit().getConfigurationClassLoader());
        }

        this.definition = loadDefinition();
        if (definition != null) {
            if (definition.getServices().size() != 1) {
                throw new IllegalArgumentException("The deployed wsdl defines more than one service");
            }
            javax.wsdl.Service wsdlSvc = (javax.wsdl.Service) definition.getServices().values().iterator().next();
            if (service == null) {
                service = wsdlSvc.getQName();
            } else if (!service.equals(wsdlSvc.getQName())) {
                throw new IllegalArgumentException("The name of the Service defined by the deployed wsdl does not match the service name of the jbi endpoint");
            }
            if (wsdlSvc.getPorts().size() != 1) {
                throw new IllegalArgumentException("The Service defined in the deployed wsdl must define exactly one Port");
            }
            Port wsdlPort = (Port) wsdlSvc.getPorts().values().iterator().next();
            if (endpoint == null) {
                endpoint = wsdlPort.getName();
            } else if (!endpoint.equals(wsdlPort.getName())) {
                throw new IllegalArgumentException("The name of the Port defined by the deployed wsdl does not match the endpoint name of the jbi endpoint");
            }
            Binding wsdlBinding = wsdlPort.getBinding();
            if (wsdlBinding == null) {
                throw new IllegalArgumentException("The Port defined in the deployed wsdl does not have any binding");
            }
            PortType wsdlPortType = wsdlBinding.getPortType();
            if (wsdlPortType == null) {
                throw new IllegalArgumentException("The Binding defined in the deployed wsdl does not have reference a PortType");
            }
            if (interfaceName == null) {
                interfaceName = wsdlPortType.getQName();
            } else if (!interfaceName.equals(wsdlPortType.getQName())) {
                throw new IllegalArgumentException("The name of the PortType defined by the deployed wsdl does not match the interface name of the jbi endpoint");
            }
            // Create the DOM document
            definition = new WSDLFlattener(definition).getDefinition(interfaceName);
            description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
        }
       
        String svcLocalName = (service != null) ? service.getLocalPart() : null;
        String svcNamespace;
        if (interfaceName != null) {
            svcNamespace = interfaceName.getNamespaceURI();
        } else if (service != null) {
            svcNamespace = service.getNamespaceURI();
        } else {
            svcNamespace = null;
        }
        Map props = new HashMap();
        props.put(ObjectServiceFactory.PORT_TYPE, interfaceName);
        if (style != null) {
            props.put(ObjectServiceFactory.STYLE, style);
        }
        props.put(ObjectServiceFactory.USE, SoapConstants.USE_LITERAL);
        if (serviceInterface != null) {
            props.put(AnnotationServiceFactory.ALLOW_INTERFACE, Boolean.TRUE);
        }
        if (properties != null) {
            props.putAll(properties);
        }
        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
        xfireService.setInvoker(new BeanInvoker(getPojo()));
        xfireService.setFaultSerializer(new JbiFaultSerializer());
        xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
        xfire.getServiceRegistry().register(xfireService);
       
View Full Code Here

        tm = (TypeMappingRegistry) knownTypeMappings.get(selectedTypeMapping);
        if (tm == null) {
            throw new Exception("Unrecognized typeMapping: " + typeMapping);
        }
        // Create factory
        ObjectServiceFactory factory = null;
        if (wa == null) {
            factory = new ObjectServiceFactory(xfire.getTransportManager(),
                                               new AegisBindingProvider(tm));
        } else if (selectedAnnotations.equals(AN_JAVA5) &&
                   selectedTypeMapping.equals(TM_JAXB2)) {
            try {
                factory = new JAXWSServiceFactory(xfire.getTransportManager());
            } catch (Exception e) {
                factory = new AnnotationServiceFactory(wa,
                        xfire.getTransportManager(),
                        new AegisBindingProvider(tm));
            }
        } else {
            factory = new AnnotationServiceFactory(wa,
                                                   xfire.getTransportManager(),
                                                   new AegisBindingProvider(tm));
        }
        // Register only JBI transport in the factory
        factory.getSoap11Transports().clear();
        factory.getSoap12Transports().clear();
        factory.getSoap11Transports().add(JbiTransport.JBI_BINDING);
        return factory;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.service.binding.ObjectServiceFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.