Refine search
protected void initializeWSDLOperationsForProvider() { Class<?> c = getProviderParameterType(getServiceClass()); if (c == null) { throw new ServiceConstructionException(new Message("INVALID_PROVIDER_EXC", LOG)); for (ServiceInfo si : getService().getServiceInfos()) { for (EndpointInfo ep : si.getEndpoints()) { enames.add(ep.getName()); QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke"); for (ServiceInfo si : getService().getServiceInfos()) { si.setProperty("soap.force.doclit.bare", Boolean.TRUE); if (!isFromWsdl()) { for (EndpointInfo ei : si.getEndpoints()) { ei.setProperty("soap.no.validate.parts", Boolean.TRUE); if (o.getOutput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getOutput().addMessagePart(o.getName()); inf.setConcreteName(new QName(o.getName().getNamespaceURI(), o.getName().getLocalPart() + "Response")); messageParts = o.getOutput().getMessageParts(); throw new ServiceConstructionException(e);
: getOutParameterName(opInfo, method, -1); if (qname.getLocalPart().startsWith("arg") || qname.getLocalPart().startsWith("return")) { qname = isOut ? new QName(qname.getNamespaceURI(), method.getName() + "Response") : new QName(qname .getNamespaceURI(), method.getName()); for (SchemaInfo s : serviceInfo.getSchemas()) { if (s.getNamespaceURI().equals(qname.getNamespaceURI())) { schemaInfo = s; throw new ServiceConstructionException(new Message("UNMAPPABLE_PORT_TYPE", LOG, method.getDeclaringClass().getName(), method.getName(),
public BindingInfo createBindingInfo(Service service, String namespace, Object obj) { URIMapper mapper = new URIMapper(); ServiceInfo si = service.getServiceInfos().get(0); BindingInfo info = new BindingInfo(si, HttpBindingFactory.HTTP_BINDING_ID); info.setName(new QName(si.getName().getNamespaceURI(), si.getName().getLocalPart() + "HttpBinding")); service.put(URIMapper.class.getName(), mapper); MethodDispatcher md = (MethodDispatcher) service.get(MethodDispatcher.class.getName()); for (OperationInfo o : si.getInterface().getOperations()) { BindingOperationInfo bop = info.buildOperation(o.getName(), o.getInputName(), o.getOutputName()); throw new ServiceConstructionException(e); } catch (NoSuchMethodException e) { throw new ServiceConstructionException(e);
protected void checkForElement(ServiceInfo serviceInfo, MessagePartInfo mpi) { SchemaInfo si = getOrCreateSchema(serviceInfo, mpi.getElementQName().getNamespaceURI(), getQualifyWrapperSchema()); XmlSchemaElement e = si.getSchema().getElementByName(mpi.getElementQName().getLocalPart()); if (e != null) { mpi.setXmlSchema(e); return; } XmlSchema schema = si.getSchema(); si.setElement(null); //cached element is now invalid XmlSchemaElement el = new XmlSchemaElement(schema, true); 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); }
services = builder.buildServices(definition); } catch (XmlSchemaException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); throw new ServiceConstructionException(new Message("NO_SERVICE_EXC", LOG)); serviceName = services.get(0).getName(); if (!it.next().getName().equals(serviceName)) { it.remove(); definition.addService(wsdlService); } catch (Exception e) { throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName)); throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName)); endpointName); if (services.isEmpty()) { throw new ServiceConstructionException( new Message("NO_SUCH_ENDPOINT_EXC", LOG, endpointName)); throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex);
.getExtension(WSDLManager.class) .getDefinition(getServiceFactory().getWsdlURL()); Service service = getServiceFromDefinition(definition); setServiceNamespace(service.getQName().getNamespaceURI()); endpointName = new QName(getServiceNamespace(), ((Port) service.getPorts().values().iterator().next()).getName()); throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), e);
while (i.hasNext()) { JType jt = i.next(); if (jt.name().equalsIgnoreCase(part.getElementQName().getLocalPart())) { jType = jt; throw new ServiceConstructionException(new Message("NO_JAXB_CLASSMapping", LOG, name)); throw new ServiceConstructionException(e);
void createService(ProtocolVariation protocol) { ServiceInfo si = new ServiceInfo(); si.setProperty(Schema.class.getName(), getSchema()); QName serviceQName = new QName(protocol.getWSRMNamespace(), SERVICE_NAME); si.setName(serviceQName); buildInterfaceInfo(si, protocol); WrappedService service = new WrappedService(applicationEndpoint.getService(), serviceQName, si); DataBinding dataBinding = null; Class<?> create = protocol.getCodec().getCreateSequenceType(); try { JAXBContext ctx = JAXBContext.newInstance(PackageUtils.getPackageName(create), create.getClassLoader()); dataBinding = new JAXBDataBinding(ctx); } catch (JAXBException e) { throw new ServiceConstructionException(e); } service.setDataBinding(dataBinding); service.setInvoker(servant); services.put(protocol, service); }
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())); ServiceInfo serviceInfo = new ServiceInfo(); SchemaCollection col = serviceInfo.getXmlSchemaCollection(); col.getXmlSchemaCollection().setSchemaResolver(new CatalogXmlSchemaURIResolver(this.getBus())); col.getExtReg().registerSerializer(MimeAttribute.class, new MimeSerializer()); setServiceProperties(); serviceInfo.setName(getServiceQName()); serviceInfo.setTargetNamespace(serviceInfo.getName().getNamespaceURI()); for (ServiceInfo si : getService().getServiceInfos()) { if (wrapperClasses != null && !wrapperClasses.isEmpty()) { si.setProperty(EXTRA_CLASS, wrapperClasses);
protected InterfaceInfo getInterfaceInfo() { if (getEndpointInfo() != null) { return getEndpointInfo().getInterface(); } QName qn = this.getInterfaceName(); 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)); }
public WSDLServiceFactory(Bus b, URL url) { setBus(b); wsdlUrl = url; try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl); } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } } public WSDLServiceFactory(Bus b, String url) {
protected void createEndpoints() { Service service = getService(); BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class); for (ServiceInfo inf : service.getServiceInfos()) { for (EndpointInfo ei : inf.getEndpoints()) { for (BindingOperationInfo boi : ei.getBinding().getOperations()) { updateBindingOperation(boi); } try { bfm.getBindingFactory(ei.getBinding().getBindingId()); } catch (BusException e1) { continue; } try { Endpoint ep = createEndpoint(ei); service.getEndpoints().put(ei.getName(), ep); } catch (EndpointException e) { throw new ServiceConstructionException(e); } } } }
public void bind(OperationInfo o, Method... methods) { Method [] newMethods = new Method[methods.length]; int i = 0; for (Method m : methods) { try { newMethods[i] = getImplementationMethod(m); i++; } catch (NoSuchMethodException e) { if (m.getName().endsWith("Async") && (Future.class.equals(m.getReturnType()) || Response.class.equals(m.getReturnType()))) { newMethods[i] = m; i++; continue; } Class<?> endpointClass = implInfo.getImplementorClass(); Message msg = new Message("SEI_METHOD_NOT_FOUND", LOG, m.getName(), endpointClass.getName()); throw new ServiceConstructionException(msg, e); } } super.bind(o, newMethods); }
try { if (!StringUtils.isEmpty(db.ref())) { return getBus().getExtension(ResourceManager.class).resolveResource(db.ref(), db.value()); obj = getBus().getProperty(DataBinding.class.getName()); throw new ServiceConstructionException(e);
public static BindingInfo createBindingInfo(Bus bus, Service service, String bindingURI) { try { BindingFactoryManager mgr = bus .getExtension(BindingFactoryManager.class); BindingFactory bindingFactory = mgr.getBindingFactory(bindingURI); if (bindingFactory != null) { BindingInfo bindingInfo = bindingFactory.createBindingInfo( service, bindingURI, null); service.getServiceInfos().get(0).addBinding(bindingInfo); return bindingInfo; } else { return null; } } catch (BusException x) { log.error("Failed to access CXF bus",x); return null; } catch (Exception x) { throw new ServiceConstructionException(x); } }
try { if (bus != null) { ClassLoader loader = bus.getExtension(ClassLoader.class); if (loader != null) { orig = ClassLoaderUtils.setThreadContextClassloader(loader); getBindingFactory()); if (ep.getService().getInvoker() == null) { if (invoker == null) { ep.getService().setInvoker(createInvoker()); } else { ep.getService().setInvoker(invoker); throw new ServiceConstructionException(e);
try { Bus bus = getBus(); ClassLoader loader = bus.getExtension(ClassLoader.class); if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); ep.getService().setInvoker(createInvoker()); } else { ep.getService().setInvoker(invoker); throw new ServiceConstructionException(e); } catch (BusException e) { throw new ServiceConstructionException(e); } catch (IOException e) { throw new ServiceConstructionException(e); } catch (Exception e) { throw new ServiceConstructionException(e); } finally { if (origLoader != null) {
protected void checkResources(boolean server) { List<ClassResourceInfo> list = serviceFactory.getRealClassResourceInfo(); if (server) { for (Iterator<ClassResourceInfo> it = list.iterator(); it.hasNext();) { ClassResourceInfo cri = it.next(); if (!isValidClassResourceInfo(cri)) { it.remove(); } } } if (list.isEmpty()) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE", BUNDLE); LOG.severe(msg.toString()); throw new ServiceConstructionException(msg); } }
for (ServiceInfo si : getService().getServiceInfos()) for (EndpointInfo ep : si.getEndpoints()) getEndpointInfo().getService().setProperty(CxfConstants.WSDL_LOCATION, getWsdlURL()); for (ServiceInfo si : getService().getServiceInfos()) for (OperationInfo o : si.getInterface().getOperations()) throw new ServiceConstructionException(e); throw new ServiceConstructionException(e);
for (ServiceInfo serviceInfo : service.getServiceInfos()) { JAXBContextInitializer initializer = new JAXBContextInitializer(serviceInfo, contextClasses, typeRefs, this.getUnmarshallerProperties()); initializer.walk(); if (serviceInfo.getProperty("extra.class") != null) { Set<Class<?>> exClasses = serviceInfo.getProperty("extra.class", Set.class); contextClasses.addAll(exClasses); cachedContextAndSchemas = createJAXBContextAndSchemas(contextClasses, tns); } catch (JAXBException e1) { throw new ServiceConstructionException(e1); for (ServiceInfo serviceInfo : service.getServiceInfos()) { SchemaCollection col = serviceInfo.getXmlSchemaCollection(); throw new ServiceConstructionException("SCHEMA_GEN_EXC", LOG, e);