Package org.codehaus.xfire.service.binding

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


    public ServiceFactory getServiceFactory()
    {
        if (factory == null)
        {
            ObjectServiceFactory ofactory = new ObjectServiceFactory(getTransportManager(),
                    new MessageBindingProvider());

            ofactory.setStyle(SoapConstants.STYLE_MESSAGE);

            factory = ofactory;
        }

        return factory;
View Full Code Here


        implements Configurator
{
    public Service createService(PlexusConfiguration config)
            throws Exception
    {
        ObjectServiceFactory builder = getServiceFactory(config);

        String name = config.getChild("name").getValue("");
        String namespace = config.getChild("namespace").getValue("");
        String use = config.getChild("use").getValue("literal");
        String style = config.getChild("style").getValue("wrapped");
        String serviceClass = config.getChild("serviceClass").getValue();
        String role = config.getChild("role").getValue(serviceClass);
        String soapVersion = config.getChild("soapVersion").getValue("1.1");
        String wsdlUrl = config.getChild("wsdl").getValue("");


        Class clazz = getClass().getClassLoader().loadClass(serviceClass);
        Service service;
        SoapVersion version = null;
        if (soapVersion.equals("1.1"))
        {
            version = Soap11.getInstance();
        }
        else if (soapVersion.equals("1.2"))
        {
            version = Soap12.getInstance();
        }

        builder.setStyle(style);
        builder.setUse(use);

        if (name.length() == 0 && namespace.length() == 0)
        {
            service = builder.create(clazz, (Map) null);
        }
        else
        {
            service = builder.create(clazz, name, namespace, null);
        }

        PlexusConfiguration[] types = config.getChild("types").getChildren("type");
        for (int i = 0; i < types.length; i++)
        {
            initializeType(types[i],
                           ((AegisBindingProvider) builder.getBindingProvider()).getTypeMapping(service));
        }


        // Setup the Invoker
        final String scope = config.getChild("scope").getValue("application");
View Full Code Here

    protected ObjectServiceFactory getServiceFactory(String builderClass, BindingProvider bindingProvider)
            throws Exception
    {
        if (builderClass.length() == 0)
        {
            return new ObjectServiceFactory(getXFire().getTransportManager(), null);
        }
        else
        {
            Class clz = loadClass(builderClass);
            Constructor con =
View Full Code Here

    public ServiceFactory getServiceFactory() throws Exception
    {
        if (factory == null)
        {
            ObjectServiceFactory ofactory =
                new ObjectServiceFactory(getXFire().getTransportManager(),
                                         new MessageBindingProvider());
           
            ofactory.setStyle(SoapConstants.STYLE_MESSAGE);
           
            factory = ofactory;
        }

        return factory;
View Full Code Here

    protected void setUp()
        throws Exception
    {
        super.setUp();

        setServiceFactory(new ObjectServiceFactory(getTransportManager(),
                new AegisBindingProvider()));
    }
View Full Code Here

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

        ObjectServiceFactory osf = (ObjectServiceFactory) serviceFactory;

        SpringServiceConfiguration springConfig = new SpringServiceConfiguration();
        springConfig.setMethods(operations);
        osf.getServiceConfigurations().add(0, springConfig);


        /**
         * Use the ServiceInterface if that is set, otherwise use the Class of
         * the service object.
         */
        Class intf = getServiceClass();
        if (intf == null)
        {
            if (getServiceBean() == null)
                throw new RuntimeException("Error creating service " + name +
                        ". The service class or the service bean must be set!");
           
            intf = SpringUtils.getUserTarget(getServiceBean()).getClass();
        }
       
        // Lets set up some properties for the service
        if (createDefaultBindings)
              properties.put(ObjectServiceFactory.CREATE_DEFAULT_BINDINGS, Boolean.TRUE);
        else
            properties.put(ObjectServiceFactory.CREATE_DEFAULT_BINDINGS, Boolean.FALSE);
       
        if (style != null)
            properties.put(ObjectServiceFactory.STYLE, style);
        if (use != null)
            properties.put(ObjectServiceFactory.USE, use);
        if (scope != null)
            properties.put(ObjectServiceFactory.SCOPE, scope);
       
        if (implementationClass != null)
        {
            properties.put(ObjectInvoker.SERVICE_IMPL_CLASS, implementationClass);
        }

        if (schemas != null)
        {
            properties.put(ObjectServiceFactory.SCHEMAS, schemas);
        }
       
        if (wsdlURL != null)
        {
            String home = (String) getXfire().getProperty(XFire.XFIRE_HOME);
           
            Resolver resolver = new Resolver(home, wsdlURL);
           
            URL url = resolver.getURL();
            if (url == null)
            {
                throw new XFireRuntimeException("Could not resolve WSDL URL " + wsdlURL);
            }
           
            xfireService = serviceFactory.create(intf, null, url, properties);
        }
        else
        {
            xfireService = serviceFactory.create(intf, name, namespace, properties);
        }
        xfireService.setExecutor(executor);
       
        // dirty hack to remove our ServiceConfiguration
        osf.getServiceConfigurations().remove(springConfig);
       
        if (bindings != null && serviceFactory instanceof ObjectServiceFactory)
        {
            initializeBindings();
        }
View Full Code Here

    }

    protected void initializeBindings()
        throws Exception
    {
        ObjectServiceFactory osf = (ObjectServiceFactory) serviceFactory;

        for (Iterator itr = bindings.iterator(); itr.hasNext();)
        {
            AbstractSoapBindingBean o = (AbstractSoapBindingBean) itr.next();
            org.codehaus.xfire.soap.AbstractSoapBinding binding = null;
            if (o instanceof Soap11BindingBean)
            {
                binding = osf.createSoap11Binding(xfireService, o.getName(), o.getTransport());
            }
            else if (o instanceof Soap12BindingBean)
            {
                binding = osf.createSoap12Binding(xfireService, o.getName(), o.getTransport());
            }
           
            binding.setUndefinedEndpointAllowed(o.isAllowUndefinedEndpoints());

            if (o.getEndpoints() == null) continue;
           
            for (Iterator eitr = o.getEndpoints().iterator(); eitr.hasNext();)
            {
                EndpointBean ep = (EndpointBean) eitr.next();
               
                osf.createEndpoint(xfireService, ep.getName(), ep.getUrl(), binding);
            }
        }
    }
View Full Code Here

            propertiesMap.put(AegisBindingProvider.TYPE_MAPPING_KEY, encodingUri);
        }

        if (factory instanceof ObjectServiceFactory)
        {
            ObjectServiceFactory osf = (ObjectServiceFactory) factory;
            osf.setStyle(configuration.getChild("style").getValue("wrapped"));
            osf.setUse(configuration.getChild("use").getValue("wrapped"));
        }

        final Configuration[] properties = configuration.getChildren("property");

        for (int i = 0; i < properties.length; i++)
View Full Code Here

     * @param serviceFactoryName
     * @return
     */
    protected ObjectServiceFactory loadServiceFactory(String serviceFactoryName)
    {
        ObjectServiceFactory factory = null;
        if (serviceFactoryName.length() > 0)
        {
            // Attempt to load a ServiceFactory for the user.
            try
            {
View Full Code Here

    }

    public void initialize()
            throws Exception
    {
        setFactory(new ObjectServiceFactory(m_transportManager,
                                            new AegisBindingProvider(m_typeMappingRegistry)));
    }
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.