Package org.apache.cxf.service.factory

Examples of org.apache.cxf.service.factory.ServiceConstructionException


        wsdlUrl = url;
        try {
            // use wsdl manager to parse wsdl or get cached definition
            definition = getBus().getExtension(WSDLManager.class).getDefinition(url);
        } catch (WSDLException ex) {
            throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex);
        }

        serviceName = sn;
    }
View Full Code Here


            try {
                WSDLServiceBuilder builder = new WSDLServiceBuilder(getBus());
                builder.setAllowElementRefs(allowRefs);
                services = builder.buildServices(definition);
            } catch (XmlSchemaException ex) {
                throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex);
            }
            if (services.size() == 0) {
                throw new ServiceConstructionException(new Message("NO_SERVICE_EXC", LOG));
            } else {
                //@@TODO  - this isn't good, need to return all the services
                serviceName = services.get(0).getName();
                //get all the service info's that match that first one.
                Iterator<ServiceInfo> it = services.iterator();
                while (it.hasNext()) {
                    if (!it.next().getName().equals(serviceName)) {
                        it.remove();
                    }
                }
            }
        } else {
            javax.wsdl.Service wsdlService = definition.getService(serviceName);
            if (wsdlService == null) {
                if ((!PartialWSDLProcessor.isServiceExisted(definition, serviceName))
                    && (!PartialWSDLProcessor.isBindingExisted(definition, serviceName))
                    && (PartialWSDLProcessor.isPortTypeExisted(definition, serviceName))) {
                    try {
                        Map<QName, PortType> portTypes = CastUtils.cast(definition.getPortTypes());
                        String existPortName = null;
                        PortType portType = null;
                        for (QName existPortQName : portTypes.keySet()) {
                            existPortName = existPortQName.getLocalPart();
                            if (serviceName.getLocalPart().contains(existPortName)) {
                                portType = portTypes.get(existPortQName);
                                break;
                            }
                        }
                        WSDLFactory factory = WSDLFactory.newInstance();
                        ExtensionRegistry extReg = factory.newPopulatedExtensionRegistry();
                        Binding binding = PartialWSDLProcessor.doAppendBinding(definition,
                                                                               existPortName, portType, extReg);
                        definition.addBinding(binding);
                        wsdlService = PartialWSDLProcessor.doAppendService(definition,
                                                                           existPortName, extReg, binding);
                        definition.addService(wsdlService);
                    } catch (Exception e) {
                        throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
                    }
                } else {
                    throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
                }
            }
            try {
                services = new WSDLServiceBuilder(getBus()).buildServices(definition,
                                                                          wsdlService,
                                                                          endpointName);
                if (services.size() == 0) {
                    throw new ServiceConstructionException(
                        new Message("NO_SUCH_ENDPOINT_EXC", LOG, endpointName));
                }
            } catch (XmlSchemaException ex) {
                throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex);
            }
        }
        ServiceImpl service = new ServiceImpl(services);
        setService(service);
        return service;
View Full Code Here

            } catch (NoSuchMethodException nsme) {
                //ignore, use the no-arg constructor
            }           
            return cls.newInstance();
        } catch (Exception e) {
            throw new ServiceConstructionException(e);
        }
    }
View Full Code Here

                try {
                    Endpoint ep = createEndpoint(ei);

                    service.getEndpoints().put(ei.getName(), ep);
                } catch (EndpointException e) {
                    throw new ServiceConstructionException(e);
                }
            }
        }
    }
View Full Code Here

    protected void buildServiceFromClass() {
        Object o = getBus().getProperty("requireExplicitContractLocation");
        if (o != null
            && ("true".equals(o) || Boolean.TRUE.equals(o))) {
            throw new ServiceConstructionException(new Message("NO_WSDL_PROVIDED", LOG,
                                                               getServiceClass().getName()));
        }
        if (LOG.isLoggable(Level.INFO)) {
            LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
        }
View Full Code Here

        if (isFromWsdl()) {
            buildServiceFromWSDL(getWsdlURL());
        } else if (getServiceClass() != null) {
            buildServiceFromClass();
        } else {
            throw new ServiceConstructionException(new Message("NO_WSDL_NO_SERVICE_CLASS_PROVIDED", LOG, getWsdlURL()));
        }

        if (isValidate()) {
            validateServiceModel();
        }
View Full Code Here

                LOG.warning(error.getMessage());
                return true;
            }
        });
        if (errorBuilder.length() > 0) {
            throw new ServiceConstructionException(new Message("XSD_VALIDATION_ERROR", LOG,
                                                               errorBuilder.toString()));
        }
    }
View Full Code Here

        for (ServiceInfo si : getService().getServiceInfos()) {
            if (qn.equals(si.getInterface().getName())) {
                return si.getInterface();
            }
        }
        throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", LOG, qn));
    }
View Full Code Here

        el.setName(mpi.getElementQName().getLocalPart());
        el.setNillable(true);

        XmlSchemaType tp = (XmlSchemaType)mpi.getXmlSchema();
        if (tp == null) {
            throw new ServiceConstructionException(new Message("INTRACTABLE_PART", LOG,
                                                               mpi.getName(),
                                                               mpi.getMessageInfo().getName()));
        }
        el.setSchemaTypeName(tp.getQName());
        mpi.setXmlSchema(el);
View Full Code Here

                mpi.setElementQName(qname);
                mpi.setConcreteName(qname);
                continue;
            } else {
                if (null == mpi.getTypeQName() && mpi.getXmlSchema() == null) {
                    throw new ServiceConstructionException(new Message("UNMAPPABLE_PORT_TYPE", LOG,
                                                                       method.getDeclaringClass().getName(),
                                                                       method.getName(),
                                                                       mpi.getName()));
                }
                if (mpi.getTypeQName() != null) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.service.factory.ServiceConstructionException

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.